Omniscio

OmniscioGuidesCLAUDE_CODE_AUTO_COMPACT_WINDOW is too large

CLAUDE_CODE_AUTO_COMPACT_WINDOW is too large, so Claude Code treats it as the 1M maximum

Last checked against Anthropic's documentation on November 21, 2026. By the Omniscio team. Updated .

What is the exact message?

CLAUDE_CODE_AUTO_COMPACT_WINDOW="<value>" is too large, so Claude Code treats it as the 1M maximum

The 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=200 is a 200-token window, not 200,000; that trips the 100k-minimum warning instead of this one.

How do I fix it?

  1. 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.
  2. Set the variable to a form Claude Code reads. A plain token count such as 1000000 works everywhere. On Claude Code v2.1.304 or later you can also write 1M for millions or 200k for 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.
  3. To keep the largest window, use 1M or 1000000. That is Anthropic's stated way to stop this warning while keeping the biggest window.
  4. Or unset the variable to fall back to the window from /autocompact, --autocompact or the autoCompactWindow setting.
  5. 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.
  • /autocompact reports 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

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.