Follow Discord
Sweep 24 Nov 2026 · 22:58Z Build v2.1.332 549 read Stable v2.1.325 Latest v2.1.331 Next v2.1.332 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Run tool calls from code with Code Mode changedcode-mode

Nearest release: v2.1.332, published 4 hours after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 24 Nov 2026 17:31 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 24 Nov 2026 17:37 UTC.

Upstream edited
Recorded here
Lines+40added
Lines−25removed
From line 35 where the diff opens
First seen 13 Nov 2026 this site's first read of the page
Recorded edits11to this page, all time

### Tool call ran after a hook failed

The whole hunk

from line 35, old and new numbered
/
lines
from line 35
3535 
3636Before you turn on Code Mode, check that you can accept these limits:
3737 
38* **Resuming**: you can resume a Code Mode session only in the terminal, with Code Mode on
38* **Resuming**: you can resume a Code Mode session only with Code Mode on. After a Code Mode session has run with a Claude subscription or a Console account, you can't resume it on a cloud provider such as Amazon Bedrock
3939* **Auto mode**: auto mode's classifier [reviews the code, not each tool call](#permission-checks)
4040* **Long-running code**: unless [code can run in the background](#long-running-code), you wait for it to finish, and it stops after ten minutes
41* **Hooks**: you can see [tool calls refused](#tool-call-refused-by-a-hook) when a `PreToolUse` hook doesn't finish, for example after a timeout
41* **Hooks**: by default, expect a [refused tool call](#tool-call-refused-by-a-hook) when a `PreToolUse` hook doesn't finish, and a [call that can still run](#tool-call-ran-after-a-hook-failed) when the hook fails another way
4242* **Unavailable features**: you can't use [Remote Control](https://code.claude.com/docs/en/remote-control.md), [Claude in Chrome](https://code.claude.com/docs/en/chrome.md), or [computer use](https://code.claude.com/docs/en/computer-use.md)
4343* **Moving the session**: you can't move the session to the Desktop app or turn it into a [background session](https://code.claude.com/docs/en/agent-view.md), and `/fork` can't start a background copy
4444 
from line 45
4545## Requirements
4646 
4747* **Version**: Claude Code v2.1.323 or later, on either [release channel](https://code.claude.com/docs/en/setup.md#configure-release-channel). An older version starts without Code Mode, with or without the reason `it isn't open to your account yet`
48* **Account**: a Claude subscription or Console account. You can't use Code Mode through a gateway, Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform, Microsoft Foundry, or [Claude Models on Google Cloud (Anthropic managed)](https://code.claude.com/docs/en/claude-models-on-google-cloud-anthropic-managed.md)
48* **Account or provider**: a Claude subscription, a Console account, or a [cloud provider](https://code.claude.com/docs/en/feature-availability.md#availability-by-model-provider) such as Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry. With a cloud provider, you need v2.1.331 or later. You can't use Code Mode through a [gateway](https://code.claude.com/docs/en/gateways.md) or with Claude for Government. If you reach a cloud provider with an [Enterprise Admin Console sign-in](https://code.claude.com/docs/en/authentication.md#log-in-to-claude-code), you need Agent Platform, or Amazon Bedrock without the [Mantle endpoint](https://code.claude.com/docs/en/amazon-bedrock.md#use-the-mantle-endpoint)
4949* **Organization**: your organization doesn't use the [HIPAA configuration](https://code.claude.com/docs/en/hipaa-setup.md) or [zero data retention](https://code.claude.com/docs/en/zero-data-retention.md)
50* **Model**: Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2
50* **Model**: Claude Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2. If you select the model by a deployment name or an application inference profile, ask whoever manages that name whether it points to one of these models
5151* **Surface**: an interactive `claude` session in a terminal. Code Mode doesn't work with the VS Code panel, the Desktop app, or cloud sessions
5252* **Agent teams**: to use Code Mode with [agent teams](https://code.claude.com/docs/en/agent-teams.md) on, you need v2.1.326 or later. Teammates run in Code Mode in the default [in-process display mode](https://code.claude.com/docs/en/agent-teams.md#choose-a-display-mode), and start without it in split panes
5353* **Mods**: to use Code Mode with a [mod](https://code.claude.com/docs/en/plugins/mods/overview.md) that hooks tool calls, you need v2.1.327 or later. If you're on the `stable` channel and an update doesn't reach that version, [switch to `latest`](https://code.claude.com/docs/en/setup#configure-release-channel)
from line 55
5555* **Installation**: the [native build](https://code.claude.com/docs/en/setup.md) of Claude Code
5656* **Windows**: [Git for Windows](https://git-scm.com/downloads/win) is installed
5757 
58You also can't start Code Mode with some settings on, such as an API key helper. For the fix for each, see [Code Mode doesn't start](#code-mode-doesnt-start).
58You also can't start Code Mode with some settings on, such as an API key helper on a direct connection to Anthropic. For the fix for each, see [Code Mode doesn't start](#code-mode-doesnt-start).
5959 
6060## Try Code Mode
6161 
from line 63
6363 
6464**1. Check your version**
6565 
66Run `claude --version`. If the version is older than v2.1.323, run `claude update`. If you're on the `stable` channel and the update doesn't reach v2.1.323, wait for `stable` to catch up or [switch to `latest`](https://code.claude.com/docs/en/setup#configure-release-channel).
66Run `claude --version`. If the version is older than the one you [need for your setup](#requirements), run `claude update`. If you're on the `stable` channel and the update doesn't reach that version, wait for `stable` to catch up or [switch to `latest`](https://code.claude.com/docs/en/setup#configure-release-channel).
6767 
6868**2. Start Claude Code with Code Mode on**
6969 
from line 124
124124 
125125### Turn off Code Mode
126126 
127Remove `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` from your shell and from `~/.claude/settings.json`, then start a new session. You can also keep the variable and change its value to `0` in either place. With a `0` in one place, Code Mode stays off even if you set `1` in the other.
127Remove `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` from your shell, `~/.claude/settings.json`, and any `--settings` file, then start a new session. You can also keep the variable and change its value to `0` in any of them. With a `0` in one place, Code Mode stays off even if you set `1` in another.
128128 
129129### Block Code Mode for your organization
130130 
from line 138
138138}
139139```
140140 
141If your users can connect through a cloud provider, deploy this setting through [MDM or a managed settings file](https://code.claude.com/docs/en/managed-settings.md#delivery-mechanisms). A user who sets a provider variable such as `CLAUDE_CODE_USE_BEDROCK` in their shell or user settings can start Code Mode without receiving [server-managed settings](https://code.claude.com/docs/en/server-managed-settings.md#platform-availability).
142 
141143Users who are in a Code Mode session stay in it until they exit or restart Claude Code. After that, your users start without Code Mode and can't resume their Code Mode sessions while the `0` is in place. You can't turn on Code Mode for your users from managed settings.
142144 
143145### Monitor Code Mode with OpenTelemetry
from line 158
156158 
157159In auto and `bypassPermissions` modes, code can run from start to finish without a permission prompt. Some calls still prompt you, such as the [actions no mode auto-approves](https://code.claude.com/docs/en/permission-modes.md#actions-no-mode-auto-approves).
158160 
159Each tool call in the code goes through your `deny` and `ask` [permission rules](https://code.claude.com/docs/en/permissions.md) and [`PreToolUse` hooks](https://code.claude.com/docs/en/hooks#pretooluse) under the tool's usual name, such as `Bash` or an [MCP tool's name](https://code.claude.com/docs/en/permissions.md#mcp). Beyond rules and hooks, a classifier reviews the code in auto mode, and you answer prompts in the modes that ask:
161To control tool calls in the code, write `deny` and `ask` [permission rules](https://code.claude.com/docs/en/permissions.md) and [`PreToolUse` hooks](https://code.claude.com/docs/en/hooks#pretooluse) under the tool's usual name, such as `Bash` or an [MCP tool's name](https://code.claude.com/docs/en/permissions.md#mcp). Beyond rules and hooks, a classifier reviews the code in auto mode, and you answer prompts in the modes that ask:
160162 
161163* **[Auto mode](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode)**: the classifier reviews each piece of code before it runs, not each tool call. It doesn't see values computed at run time, such as a path taken from search output, so keep rules or hooks for calls you must control. You can still be [prompted for some calls](#permission-prompt-with-a-countdown), such as calls in code that you approved yourself after repeated classifier blocks
162164* **Other [permission modes](https://code.claude.com/docs/en/permission-modes.md)**: you're prompted for each tool call that would prompt you in that mode
from line 223
221223 
222224For background code, start your session in auto or `bypassPermissions` mode. If Claude still waits, check your current mode and how you started the session:
223225 
224* **You switched to another mode**: press `Shift+Tab` until you're back in the mode you started in
225* **You started in another mode**: if [auto mode is available](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) to you, exit, then run `claude --continue --permission-mode auto` with Code Mode on
226* **You're on a version before v2.1.328 and picked the session from the `claude --resume` list**: exit, [update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code), then run the same `claude --resume` command with Code Mode on. To stay on your version, replace `--resume` with `--continue`
227* **You passed tool names to `--tools`**: start again in auto mode without that flag
226* **You're on a version before v2.1.328 and picked the session from the `claude --resume` list**: exit, [update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code), then run the same `claude --resume` command with Code Mode on. To stay on your version, replace `--resume` with `--continue`. If Claude still waits after the update, start a new session in auto mode
227* **You passed tool names to `--tools`**: start a new session in auto mode, with Code Mode on and without that flag
228* **The session first started in auto or `bypassPermissions` mode**: press `Shift+Tab` until you're back in that mode. If that doesn't help, exit, then run `claude --continue --permission-mode auto` with Code Mode on
229* **The session first started in another mode**: if [auto mode is available](https://code.claude.com/docs/en/permission-modes.md#eliminate-prompts-with-auto-mode) to you, exit, then run `claude --permission-mode auto` with Code Mode on to start a new session. On v2.1.331 or later, expect Claude to keep waiting if you resume the old session instead
228230 
229231### Stop code in progress
230232 
from line 258
256258 
257259* **Change the text**: redact `result`, `stdout`, `stderr`, and `error`. Handle a `result` that's missing or `null`, and expect `error` only when the code failed or was stopped
258260* **Keep the shape**: return `code`, `stdout`, and `stderr` as strings, and return `error` as a string or leave it out. If you break this shape, Claude gets the original output
259* **Remove images and PDFs**: if the copy has `images` or `documents` to hide, set that field to `[]`
261* **Remove images, PDFs, and page errors**: if the copy has `images`, `documents`, or `imagePagesFailed` to hide, set that field to `[]`. The `imagePagesFailed` field lists the file path and error for each PDF page that couldn't be shown
262* **Remove the path to long output**: on v2.1.331 or later, omit `uncutOutputNote` from the copy. The field gives Claude a path to the uncut text
260263 
261264To hide the deploy token in the `notes.txt` result, print this JSON:
262265 
from line 305
302305| :- | :- |
303306| `it isn't open to your account in this version` or `it isn't open to your account yet` | If your version is older than v2.1.323, [update](#try-code-mode). Otherwise, check your network connection and start again. If the reason stays, try again another day |
304307| `Anthropic has turned it off for now` | [Update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code), or start again later |
305| `it only works directly with the Anthropic API` or `it only works with the Anthropic API` | Remove the settings that route requests through a cloud provider, a gateway, or a custom `ANTHROPIC_BASE_URL` |
308| `it only works directly with the Anthropic API` or `it only works with the Anthropic API` | If you use a cloud provider without a gateway, [update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code) to v2.1.331 or later. If you use a gateway, follow the next row |
309| `it isn't offered yet through a gateway or proxy` | If your administrator set up the [gateway](https://code.claude.com/docs/en/gateways.md), you need it, or you use Claude for Government, [turn off Code Mode](#turn-off-code-mode) to stop seeing the line. Otherwise, remove [the gateway's settings](https://code.claude.com/docs/en/llm-gateway-connect.md) and key, and connect directly. You can keep `HTTPS_PROXY`. If you signed in to a Claude apps gateway, also remove [its entries from your user settings](https://code.claude.com/docs/en/claude-apps-gateway#set-the-gateway-url-in-user-settings) and run `/logout`, which removes saved MCP server logins and plugin secrets too |
310| `it isn't offered yet through a gateway or proxy`, with an [Enterprise Admin Console sign-in](https://code.claude.com/docs/en/authentication.md#log-in-to-claude-code) | Run `/status`. If `API provider` shows a provider that the [requirements](#requirements) rule out, such as `Microsoft Foundry` or `Amazon Bedrock (Mantle)`, [turn off Code Mode](#turn-off-code-mode) to stop seeing the line. Otherwise, follow the previous row |
306311| `it doesn't work with an API key helper` | Remove `apiKeyHelper`, `ANTHROPIC_AUTH_TOKEN`, and any `Authorization` or `X-Api-Key` header in `ANTHROPIC_CUSTOM_HEADERS`. Then sign in or set `ANTHROPIC_API_KEY` |
307| `it only works with Opus 5.5, Sonnet 5.5 and later models` | Start with a [supported model](#requirements), for example with `--model opus`. Haiku 5.5 and Fable 5.2 also work |
312| `it only works with Opus 5.5, Sonnet 5.5 and later models` | Pass the full name of a [supported model](#requirements) that your account can use, for example `--model claude-opus-5-5`, or on Microsoft Foundry the name of your deployment of one. Avoid aliases such as `sonnet`, which [select older models on some providers](https://code.claude.com/docs/en/model-config.md#model-aliases) |
308313| `it doesn't work in background jobs` | Start in the foreground, without `--remote-control`. If the reason shows in a teammate's split pane, use the [in-process display mode](https://code.claude.com/docs/en/agent-teams.md#choose-a-display-mode) to run teammates in Code Mode |
309314| `it needs settings that Claude Code downloads from Anthropic` | [Update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code) to meet the [telemetry settings requirement](#requirements). To stay on your version, unset the variable that [turns off feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching), such as `DISABLE_TELEMETRY` |
310315| `OpenTelemetry tracing is on` | Unset `CLAUDE_CODE_ENHANCED_TELEMETRY_BETA`, `ENABLE_ENHANCED_TELEMETRY_BETA`, and `ENABLE_BETA_TRACING_DETAILED` if you can work without [traces](https://code.claude.com/docs/en/monitoring-usage.md#traces-beta) |
from line 318
313318| `it doesn't yet work with an installed mod` | [Update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code) to meet the [mods requirement](#requirements). To stay on your version, run `/plugin` and disable each mod you installed |
314319| `it can't be used together with agent teams yet` | To keep agent teams on, [update Claude Code](https://code.claude.com/docs/en/setup.md#update-claude-code) to v2.1.326 or later. To stay on your version, unset `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` |
315320| `this launch's tool options` | Start without `--restricted`, add `REPL` to `--tools`, and remove `REPL` from `--disallowedTools` and your `deny` rules |
321| `couldn't read your organization's settings or policy` | Start again. If your Enterprise Admin Console sign-in ended, run `claude auth login` and select your organization. If the reason stays and your network blocks `api.anthropic.com`, ask your administrator to allow that host. If you use a cloud provider and not that sign-in, you can instead unset `ANTHROPIC_API_KEY` and run `claude auth logout`, which also removes saved MCP server logins and plugin secrets |
316322| `couldn't save your answer` | Make `~/.claude.json` writable |
317323| `your organization's settings don't allow it` | Ask your administrator about the [managed setting](#block-code-mode-for-your-organization) |
318324 
from line 326
320326 
321327### Permission prompt with a countdown
322328 
323In auto mode, if you approve code yourself after [repeated classifier blocks](https://code.claude.com/docs/en/permission-modes.md#when-auto-mode-falls-back), you can be asked about tool calls in that code and in earlier code that's still running. With no IDE connected, the prompt can show a countdown:
329In auto mode, if you approve code yourself after [repeated classifier blocks](https://code.claude.com/docs/en/permission-modes.md#when-auto-mode-falls-back), you can be asked about tool calls in that code and in earlier code that's still running. Expect the same in auto mode after an [`ask` rule](#approve-each-piece-of-code-first) or a `PreToolUse` hook on `REPL` has you approve the code.
324330 
331With no IDE connected, the prompt can show a countdown:
332 
325333```text theme={null}
326334Claude Code will automatically block this request in 1:59, to avoid holding up an unattended session
327335```
from line 340
332340 
333341### Tool call refused by a hook
334342 
335If Claude reports a refused tool call, ask it for the error text. These errors mean that your [`PreToolUse` hook](https://code.claude.com/docs/en/hooks#pretooluse) didn't give a decision:
343If Claude reports a refused call, ask it for the error text. These errors mean your [`PreToolUse` hook](https://code.claude.com/docs/en/hooks#pretooluse) gave no decision:
336344 
337* **`the hook did not finish`**: your hook timed out, or your agent hook ended without a decision. After a timeout, raise the hook's [`timeout`](https://code.claude.com/docs/en/hooks#common-fields). For an agent hook that gives no decision, move the check to a `command` hook. You can see this error on calls from code, and on other tool calls after Claude runs code in the session
338* **`the hook failed`**: on a call from code, your hook couldn't start, was killed, exited with 126, 127, or a code above 128, or returned an HTTP error or invalid output. Fix the hook. You can see this error before v2.1.329. On later versions it's rare: one cause is [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) turning off during a session, after Claude has run code
345* **`the hook did not finish`**: your hook timed out, or your agent hook ended without a decision. Raise the hook's [`timeout`](https://code.claude.com/docs/en/hooks#common-fields), or set [`"onFailure": "continue"`](#tool-call-ran-after-a-hook-failed) on a `command` or `http` hook. If an agent hook still gives this error, move the check to a `command` hook. After Claude runs code, you can see this error on calls outside code too
346* **`the hook failed`**: your hook failed on a call from code, for example because it couldn't start. Find the failure in the [debug log](https://code.claude.com/docs/en/hooks.md#debug-hooks) and fix it. Expect this error before v2.1.329. On later versions, you can see it after you turn off [feature-flag fetching](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching) during a session
339347 
340On v2.1.329 or later, expect a call from code to run by default after a hook failure other than `the hook did not finish`. To choose whether the call runs, use a `command` or `http` hook and set [`onFailure`](https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails) on it:
348### Tool call ran after a hook failed
341349 
342* **To stop the call after a timeout or failure**: set `"onFailure": "block"`. Do this for a hook that guards calls
343* **To let the call run after a timeout or failure**: set `"onFailure": "continue"`
350To stop a call from code when its `PreToolUse` hook fails, use a `command` or `http` hook and set [`"onFailure": "block"`](https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails). If several settings files have that hook, give it the same `onFailure` value in each.
351 
352On v2.1.329 or later, expect these results for `command` and `http` hooks:
353 
354| `onFailure` | Hook times out | Hook fails another way, such as a missing script |
355| :- | :- | :- |
356| Not set | Refused | Goes on to permission checks, [with rare exceptions](#tool-call-refused-by-a-hook) |
357| `"block"` | Refused | Refused |
358| `"continue"` | Goes on to permission checks | Goes on to permission checks |
344359 
345360### Code output withheld by a hook
346361 
Feedback