How do I stop Claude Code resuming a deferred tool call with `CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME`?
Claude Code 2.1.328 adds CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME, so claude -p --resume skips a tool call a hook deferred. Set it in the shell.
To stop claude -p --resume and --continue from running a tool call that a hook deferred, set CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME to 1 in the shell that starts Claude Code. Anthropic's changelog lists the variable in Claude Code 2.1.328, dated November 19, 2026. It is a switch for scripts and apps that run Claude Code, not for everyday chat.
This site is independent and not affiliated with Anthropic. We read the changelog and Anthropic's documentation on 2026-11-27. We did not run this variable, because it needs a hook that defers a call and a program that resumes the session. Nothing below is a hands-on result, and we show no sample output.
What a deferred tool call is
A hook is a small script that Claude Code runs before a tool, such as a shell command or a file edit. Anthropic's Agent SDK hooks page says a PreToolUse hook can answer allow, deny, ask or defer.
For defer, the same page says the turn ends with a result message whose stop_reason is "tool_deferred". In plain words, the hook parks the call and you can resume it later.
When several hooks disagree, the page gives an order: deny takes priority over defer, which takes priority over ask, which takes priority over allow.
What 2.1.328 changed
Anthropic's changelog has one line for the variable:
Added
CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME, which lets a host stopclaude -p --resumeand--continuefrom running a tool call that a hook deferred
By "host", we read a program that runs Claude Code for you. Anthropic does not define the word in that line.
The environment variables page adds the details:
- Setting it to
1skips the deferred call when you resume or continue with-p. - It says "Requires Claude Code v2.1.328 or later", which matches the changelog.
- It is "Ignored in a settings
envblock".
Why you might want it
Anthropic gives no reason, so this is our reading. A deferred call was parked for a purpose, usually a decision that had not arrived yet. If a script resumes that session later, you may want your new prompt to be the only thing that happens, not an old command running first.
By the same reading, it would matter most for unattended jobs, where nobody watches the first thing a resumed session does.
The Claude moves worth stealing, by email
Workflows tested on real jobs, sent only when they are worth it. Free.
How to set it
Anthropic's headless page says to use --continue for the most recent conversation, or --resume with a session ID for a specific one.
session_id=$(claude -p "Start a review" --output-format json | jq -r '.session_id')
CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME=1 claude -p "Continue that review" --resume "$session_id"
Check your version
Run claude --version. You need 2.1.328 or later.
Set it in the environment
Prefix the command as above, or export it in the shell that runs your script. Do not put it in the env block of settings.json, where it is ignored.
Resume as usual
Use --resume with a session ID, or --continue, with -p.
Read the result, not the hope
If your host depends on the call being skipped, check the transcript yourself. We could not confirm the behavior.
The two deferred-call variables
A second variable sits beside this one on the environment variables page. It covers a different case, so do not mix them up.
| Variable | What it does with -p | Version listed |
|---|---|---|
CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME | Skips a deferred call when you resume or continue | 2.1.328 |
CLAUDE_CODE_DROP_UNAVAILABLE_DEFERRED_TOOL | Drops a deferred call whose tool is not available when you resume | 2.1.319 |
For the second one, the page says "Without this variable, the call stays pending and a prompt you send doesn't reach Claude." That is a different trap: a stuck session, not an unwanted call.
If you need a real refusal
A variable that skips a resume is not a safety control. To refuse a tool, use a rule or a hook. The Agent SDK hooks page says hooks can "Block dangerous operations" before they execute.
If a hook is your gate, make it fail closed so a crash does not let calls through. Our permissions guide covers allow, ask and deny rules. A one-shot claude -p run has another limit with long MCP jobs, which our MCP task guide explains.
Where this does not help
- We did not run it. We have no output to show and cannot confirm the skipping behavior.
- We could not read the deferral sections. The environment variables page links to two hooks sections, through the anchors
defer-a-tool-call-for-laterandresume-when-a-deferred-tool-is-unavailable. Our fetch of the hooks page was cut off before them. We cannot describe the exact JSON a hook returns or the exact resume flow, so read those sections before building on this. - Only
-pis documented. The page says "when you resume or continue with-p". It says nothing about interactive resumes. - Claude can repeat the call. Skipping the parked call does not stop Claude from asking for the same tool again.
We will mention it in the newsletter if Anthropic documents the interactive case.
Which Claude Code version adds CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME?
Version 2.1.328, dated November 19, 2026 in Anthropic's changelog. The environment variables page also says it requires v2.1.328 or later. Check your own version by running claude --version.
Does CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME work in settings.json?
No. Anthropic's environment variables page says the variable is ignored in a settings env block. Set it in the environment of the process that starts claude -p, for example by putting it in front of the command.
What is a deferred tool call in Claude Code?
It is a tool call that a PreToolUse hook parked by answering defer. Per Anthropic's Agent SDK hooks page, the turn then ends with a stop_reason of "tool_deferred", and you can resume the call later.
Does it stop Claude from running the tool?
No. Anthropic's page warns that "Claude can still repeat the call." The variable only skips the parked call on resume. To refuse a tool, use a permission rule or a hook that denies it.
Sources (checked 2026-11-27)
- Claude Code changelog: the 2.1.328 entry (November 19, 2026).
- Environment variables: the
CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUMEandCLAUDE_CODE_DROP_UNAVAILABLE_DEFERRED_TOOLrows. - Run Claude Code programmatically:
--continue,--resumeand the session ID example. - Agent SDK hooks: the
deferdecision,tool_deferredand hook priority. - Hooks reference: linked from the environment variables page; the deferral sections were not readable in our fetch.
