{"version":"2.1.281","anchor":"set-model-control-request-errors-now-carry-code-invalid-requ","canonical_anchor":"set-model-control-request-errors-now-carry-code-invalid-requ","heading":"set_model validation errors now carry code invalid_request","tier":"notice","area":"SDK","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281\/e\/set-model-control-request-errors-now-carry-code-invalid-requ","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281","markdown":"### set_model validation errors now carry code invalid_request\n\nValidation errors from the set_model control request now include code \"invalid_request\" so SDK apps can check a code rather than the message\n\n**What**\n\n`set_model` is a control request, a message an app built on the Claude Code SDK sends to change the model during a session. When it rejects bad input, its error now includes `code: \"invalid_request\"` next to the existing error message. This covers:\n\n- a model value that is not a string (\"set_model: model must be a string\")\n\n- an empty `system_prompt` (\"set_model: system_prompt must be a non-empty string when present\")\n\nBefore, these errors had only `ok` and `error`.\n\n**Why**\n\nApps that talk to Claude Code can check a fixed code to spot bad input, instead of matching the wording of the error message, which may change.\n\n- Area: SDK\n- Names: `set_model`\n- Tier: You'll notice\n- Useful: 1\/5\n- Signal: 0\/5"}