
Have you ever encountered an error like the one below while using Claude Code?
⏺ anctl:function_calls
⎿ API Error: Claude's response exceeded the 32000 output token maximum. To configure this behavior, set the
CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable.In this article, I will explain the cause of this error and how to deal with it.
Cause of the error
This error occurs when the response from Claude while using Claude Code exceeds the output limit of 32,000 tokens.
Specifically, the reasons are as follows:
Claude Code has a default output limit of 32,000 tokens set.
The response Claude attempted to generate exceeded this limit.
The process was automatically stopped as a system safety feature.
General solutions
1. Adjust the limit using environment variablesexport CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000
Please adjust the numerical value as needed.
2. Break down the taskDivide large file generation or complex processes into smaller parts.
Execute tasks in stages.
Add instructions such as "be concise" or "only provide the main points."
Ask to omit unnecessary detailed explanations.
Common causes
Generating a large amount of code.
Full output of long files
Overly detailed explanations or document generation
The solution I actually used
In my case, waiting for about 5 minutes and then sending the instruction "Please process this again" resolved the issue.
While methods like setting environment variables or breaking down tasks are effective, trying to re-execute after waiting a little while is also one approach.
Points to note with the Claude 4 series (as of July 2025)
It might be dependent on my environment, but as of July 10, 2025, I feel that the Claude 4 series tends to over-interpret prompts, consuming more tokens.
About a week ago, I was able to implement things without issues by giving instructions like "Please implement XX" while breaking down tasks, but that doesn't seem to work well now.
Recommended changes to instructions
Before: "Please implement XX"
After: "Please provide the steps to implement XX" -> "Please implement this step-by-step"
As shown, you may need to switch to more detailed and step-by-step instructions.
Conclusion
Claude Code is a very powerful tool, but you need to understand its token limits. Please use the solutions introduced here as a reference to proceed with efficient development.
That's all, I hope this is helpful to someone.