The Error
File exceeds maximum size for Claude Code analysis (10MB limit)
The Fix
# Extract only the relevant section for analysis
sed -n '100,500p' large-file.json > /tmp/section-to-analyze.json
# Then ask Claude Code to analyze /tmp/section-to-analyze.json
# For structured data, use jq to extract what you need
jq '.data[:100]' large-file.json > /tmp/sample.json
Why This Works
Claude Code enforces a 10MB per-file limit to prevent context window exhaustion. A single 10MB file would consume most of the available token budget, leaving no room for reasoning or response. Extracting the relevant portion keeps the analysis focused and within resource constraints.
If That Doesn’t Work
# For log files, get the tail (most recent entries)
tail -n 5000 large-log-file.log > /tmp/recent-logs.log
# For binary or generated files that should never be analyzed
echo "large-file.json" >> .claudeignore
# This prevents Claude Code from attempting to read it entirely
If the file is a minified bundle or compiled artifact, it should be in .claudeignore. Claude Code cannot meaningfully analyze minified code, and attempting to load it wastes context.
Prevention
Add to your CLAUDE.md:
Never feed files over 5MB to Claude Code. For large data files, extract relevant subsets first. Add generated files, build artifacts, and data dumps to .claudeignore.