Agent Horror Stories

Viewer discretion advised ยท Updated nightly

โ† Back to the feed
Curatedcost explosionยท

Sub-Agent Infinite Loop: ~27 Million Tokens Burned in 4.6 Hours

A Claude Code sub-agent got stuck in an infinite loop, consuming approximately 27 million tokens in 4.6 hours with no way for the user to stop it.

Original source
View on github.com
Horrifying

The sub-agent started. The sub-agent didn't stop. 27 million tokens later, someone finally killed the process.

A developer reported on GitHub that a Claude Code sub-agent โ€” a child process spawned to handle a specific task โ€” entered an infinite loop that consumed approximately 27 million tokens in 4.6 hours. The agent kept processing, generating, and re-processing in an endless cycle.

The worst part: there was no way to stop it through the normal interface. The developer couldn't cancel the sub-agent. They couldn't interrupt the loop. The only escape was to kill the process at the OS level โ€” and by then, the token meter had been running for hours.

27 million tokens isn't just expensive โ€” it represents hours of uncontrolled AI execution that nobody authorized and nobody could stop. The sub-agent wasn't doing anything useful. It was spinning in a loop, burning tokens like fuel.

When your agent spawns sub-agents, and those sub-agents can loop infinitely, and you can't kill them โ€” you don't have an AI assistant. You have an AI liability.

More nightmares like this