Agent Context Loss After API Usage Limit Reset

Resolved 💬 5 comments Opened Aug 17, 2025 by marcoscale98 Closed Jan 7, 2026

Bug Description
Claude Code sub-agent was working when the usage limit reached. When the usage budget was reloaded, I asked to CC to continue with the plan. CC forgot that the agent was doing the specialized job for him, and continued to do the job on his own.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 1.0.83
  • Feedback ID:

Errors

[{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NX (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:1184)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:912\n    at Array.map (<anonymous>)\n    at ZW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:903)\n    at lkB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2358:8538)\n    at SR (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:330:19859)\n    at rb (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:42835)\n    at ab (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38356)\n    at wj (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38284)\n    at aR (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38138)","timestamp":"2025-08-16T20:14:52.059Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NX (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:1184)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:912\n    at Array.map (<anonymous>)\n    at ZW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:903)\n    at lkB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2358:8538)\n    at SR (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:330:19859)\n    at rb (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:42835)\n    at ab (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38356)\n    at wj (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38284)\n    at aR (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38138)","timestamp":"2025-08-16T20:14:52.073Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at NX (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:1184)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:912\n    at Array.map (<anonymous>)\n    at ZW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1774:903)\n    at fkB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2358:5231)\n    at SR (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:330:19859)\n    at rb (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:42835)\n    at ab (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38356)\n    at wj (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38284)\n    at aR (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:332:38138)","timestamp":"2025-08-16T20:14:54.218Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed your account's rate limit. Please try again later.\"}}\n    at D6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:942:2624)\n    at sP.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:2101)\n    at sP.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async KSB.sG1.showErrors (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:24578)\n    at async sG1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:13705)\n    at async KSB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:24429)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:19524\n    at async cN0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:5164)\n    at async V01 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:19494)","timestamp":"2025-08-16T21:07:22.323Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed your account's rate limit. Please try again later.\"}}\n    at D6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/cl

Note: Error logs were truncated.

Chat

> 1. @agent-code-refactoring-expert refactor the code, if necessary
  2. @agent-documentation-maintainer refactor documentation, if necessary

⏺ I'll help you refactor the code and documentation. Let me first examine
  the current codebase structure to understand what needs to be refactored.

⏺ List(~/Documents/Progetti/ev-travel-visual-comparator)
  ⎿  Listed 22 paths (ctrl+r to expand)

⏺ Let me examine the main source files to understand the current code
  structure:

⏺ Read(src/animation.js)
  ⎿  Read 477 lines (ctrl+r to expand)

⏺ Read(src/battery-system.js)
  ⎿  Read 167 lines (ctrl+r to expand)

⏺ Read(src/data-loader.js)
  ⎿  Read 56 lines (ctrl+r to expand)

⏺ Read(src/ui-controls.js)
  ⎿  Read 67 lines (ctrl+r to expand)

⏺ Now I'll launch the code-refactoring-expert agent to analyze and refactor
   the code:

⏺ code-refactoring-expert(Refactor EV simulation code)
  ⎿  Done (22 tool uses · 0 tokens · 9m 1.5s)                              
  ⎿  Claude usage limit reached. Your limit will reset at 1am (Europe/Rome).


      • /upgrade to increase your usage limit.

> /bashes 
  ⎿  (no content)

> /cost 
  ⎿  With your Claude Max subscription, no need to monitor cost — your 
     subscription includes Claude Code usage

> /mcp 
  ⎿  (no content)

> /memory 
  ⎿ Opened project memory at ./CLAUDE.md

    > Using $EDITOR="code --wait". To change editor, set $EDITOR or $VISUAL
     environment variable.

> /status 
  ⎿  (no content)

> /agents 
  ⎿  (no content)

> continue with the plan

⏺ I'll continue with the refactoring plan. Let me first use the TodoWrite tool to track the refactoring
   tasks:

⏺ Update Todos
  ⎿  ☐ Refactor SimulationEngine class - extract methods and improve organization
     ☐ Refactor BatterySystem class - improve validation and error handling
     ☐ Refactor DataLoader class - enhance CSV parsing and error handling
     ☐ Refactor UIControls class - improve event handling and state management
     ☐ Update documentation after refactoring

⏺ Now I'll start refactoring the code. Let me begin with the SimulationEngine class:

⏺ Update Todos
  ⎿  ☐ Refactor SimulationEngine class - extract methods and improve organization
     ☐ Refactor BatterySystem class - improve validation and error handling
     ☐ Refactor DataLoader class - enhance CSV parsing and error handling
     ☐ Refactor UIControls class - improve event handling and state management
     ☐ Update documentation after refactoring

⏺ Update(src/animation.js)
  ⎿  Updated src/animation.js with 94 additions and 71 removals    

...

⏺ Read(src/battery-system.js)
  ⎿  Read 20 lines (ctrl+r to expand)

⏺ I notice the file has already been modified. Let me check the current working directory structure to
  understand what's happened:

⏺ Bash(git status)
  ⎿  Sul branch master                                     
     Il tuo branch è aggiornato rispetto a 'origin/master'.
     … +15 lines (ctrl+r to expand)

⏺ It seems the files have been modified by someone else or by another process. Let me read the current
  battery-system.js to see what it looks like:

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗