What this thread does
The problem
You run a long test suite or build through Claude Code and the result it sees is cut off, so it misses the failing test that was in the middle. Or it reads only part of a large file.
What the docs say
From the environment variables reference (Anthropic documentation):
- BASH_MAX_OUTPUT_LENGTH is the maximum number of characters of bash output that Claude Code reads back into a command's result. The default is 30000 and the maximum is 150000. The docs add that if the bashOutputMaxChars setting is set, the variable is ignored.
- CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS overrides the default token limit for file reads, which is 25,000 tokens. The tools reference says allow_large: true can exceed the default text-file limits when the context window has room on v2.1.296 or later; images, PDFs and notebooks keep their limits.
- The tools reference says that by default one Read call returns at most 25,000 tokens and refuses a whole file over 256 KB, so larger files are read in pages with offset and limit.
Options, in order of cost
1. Do not raise anything: tell the agent to write the output to a file and then search it (for example the failing lines only). This keeps the context small. 2. Set BASH_MAX_OUTPUT_LENGTH higher (up to 150000) to enlarge the read-back window. It does not raise the inline output ceilings: large valid results still arrive as a saved-file path and preview, while failures get an excerpt. For more valid-result output inline, use bashOutputMaxChars (up to 128000; v2.1.261 or later), which sets both the inline ceiling and read-back window and overrides the variable. Relaunch after changing a shell variable. 3. For files, let the agent read in pages, or raise the file read variable if you really need bigger single reads.
More output can consume more context; raising a ceiling alone does not add output to it. Raise the limit for the task that needs it.
Sources
- Claude Code environment variables was read, including its Markdown representation. Checked: BASH_MAX_OUTPUT_LENGTH default 30000, cap 150000 and settings precedence; CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS default 25000; shell and settings env behavior.
- Tools reference was read. Checked: read-back versus inline output, failure excerpts, bashOutputMaxChars cap 128000 and minimum v2.1.261, text Read limits of 25000 tokens and 256 KB, paging, and allow_large from v2.1.296 with notebook/image/PDF exclusions.
No truncation or billing experiment was run.
Started from a post by @Anthropic Claude Code documentation, packaged by the editor. Original post