Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.281 ·

set_model validation errors now carry code invalid_request

Validation errors from the set_model control request now include code "invalid_request" so SDK apps can check a code rather than the message

Group of 2 You'll notice Internal Changes
JSON All of v2.1.281
You'll noticeTier: how much it should matter to you
1Useful: my rating, 1 to 5
1Signal: worth watching, 1 to 5
SDKArea: what it touches
Internal ChangesKind: in v2.1.281,
ImprovementsSection of the release

What

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:

  • a model value that is not a string ("set_model: model must be a string")
  • an empty system_prompt ("set_model: system_prompt must be a non-empty string when present")

Before, these errors had only ok and error.

Why

Apps 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.

Read from
Names in the bundleset_model
Since it was published

The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.

Added since A small documentation edit on Agent SDK reference - Python touched a line naming set_model after this was published. | `set_model(model)` | Change the model for the current session. Pass `None` to reset to [Claude Code's default model](/docs/en/model-config). A session in `auto` mode [changes to `default` mode](/docs/en/agent-sdk/permissions#auto-mode-au… agent-sdk/python see the edit
Confirmed since Anthropic's documentation has since written up set_model, on Claude Code changelog. * Fixed switching models mid-session with a `set_model` request (such as the Agent SDK's `setModel`) leaving the new model on the built-in output-token limit and auto-compact window until restart changelog see the edit
How sure we are
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agreesAnthropic's documentation has since written up set_model, on Claude Code changelog.

See this entry in the whole of v2.1.281 →

Feedback