What is the exact message?
CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" is too large, so Claude Code treats it as the 1M maximumThe warning prints the value you set in place of <value>. Anthropic's table lists it beside two neighbours: reads as <N> tokens, so Claude Code treats it as the 100k minimum and isn't a usable size, so Claude Code ignores it.
How this differs from the compaction pages. It is not a compaction failure: you see a warning and the session keeps working. The four compaction guides cover a compaction that failed — the compaction errors guide indexes all of those — while this page covers the window you configured being capped.
What does it mean?
A warning that quotes your CLAUDE_CODE_AUTO_COMPACT_WINDOW value means your session is not using the value as you set it.
For this particular warning, the window the session uses is the smaller of 1,000,000 tokens and your model's context window. Claude Code caps the window at the model's context window whichever way you set it, so a value above the cap cannot take effect exactly as written.
Why does it appear?
- The value you set is above 1,000,000 tokens. That is the condition Anthropic's table gives for this warning.
1048576— a megabyte counted in bytes — sits above it, and so does any number larger than the cap. - The variable takes a token count, not a byte count. A value carried over from a byte figure is read as tokens, which can put it above the cap.
- A bare number means exactly that many tokens.
CLAUDE_CODE_AUTO_COMPACT_WINDOW=200is a 200-token window, not 200,000; that trips the 100k-minimum warning instead of this one.
How do I fix it?
- Decide which window you want. The largest the variable accepts is 1,000,000 tokens. If you meant the largest window, that is the value to write.
- Set the variable to a form Claude Code reads. A plain token count such as
1000000works everywhere. On Claude Code v2.1.304 or later you can also write1Mfor millions or200kfor thousands. The variable is read from the environment of the shell that starts Claude Code, so change it in your shell profile or the terminal you launch from. - To keep the largest window, use
1Mor1000000. That is Anthropic's stated way to stop this warning while keeping the biggest window. - Or unset the variable to fall back to the window from
/autocompact,--autocompactor theautoCompactWindowsetting. - Remember it outranks the other controls. While the variable is set, it takes precedence over the command, the flag and the setting, unless Claude Code ignores the value.
How do I know it is fixed?
- The warning no longer appears when a session starts, or when the value is next read.
/autocompactreports the window you set, and does not describe it as an override if you unset the variable.- The conversation still runs; this warning never stopped it.
Where these answers come from
- The warning's wording, the window it falls back to, the 1M or 1000000 fix, the accepted forms and the 100k minimum neighbour: Anthropic's model configuration page, Values and warnings for CLAUDE_CODE_AUTO_COMPACT_WINDOW, read November 21, 2026.
- The same warning in the message table, and the precedence over
/autocompact, the flag and the setting: Anthropic's error reference and the auto-compact window section, read November 21, 2026. - The cap at the model's context window: Anthropic's model configuration page, read November 21, 2026.
Common questions
Is this the same as a compaction failure?
No. This is a warning about the window you configured, and the session keeps working. Compaction failures such as Compaction failed · conversation could not be reduced below the context limit are a different set of messages, covered on the compaction errors page.
What window is the session actually using?
The smaller of 1,000,000 tokens and your model's context window, according to Anthropic's table for this warning. The value you set is not being used as you wrote it.
How do I stop the warning?
Set CLAUDE_CODE_AUTO_COMPACT_WINDOW to 1000000 (or 1M on v2.1.304 or later), which is the largest window the variable accepts, or to a smaller number such as 200000 if you meant a smaller window, or unset the variable.
Why did 1048576 trigger it?
Because the cap is 1,000,000 tokens, not 1,048,576. A value written as 1 MiB in tokens is above the variable's maximum, so Claude Code treats it as the 1M maximum instead of using it exactly.
Does the variable beat /autocompact and the setting?
Yes. While it is set, the variable takes precedence over the /autocompact command, the --autocompact flag and the autoCompactWindow setting, and /autocompact reports the override without saving it. The exception is a value Claude Code cannot use at all: then it falls back and says so with one of the other warnings in the same table.