CourseAgentic AI Engineer: The Complete Course · Module 14: Observability and Debugging · part 81 of 97
Part 81 · Module 14: Observability and Debugging

Incident: An unattended loop found on the bill

7 min read·13 Oct 2026
Module 14 · Incident file · About 30 minutes

What happened

On 17 March 2026 a Claude Code user, jialejiahi, opened GitHub issue #35166 on the anthropics/claude-code repository: "Claude Code sends repeated requests hundreds of times without stopping". The report reads: "Claude Code entered an infinite loop, repeatedly sending the same requests for several hours (~1 minute interval between each). This resulted in $500+ of unexpected token usage."

ISSUE #35166, AS REPORTED 17 Mar 2026 left unattended after /compact next day still running $500+ on the bill 18 to 20 Mar users add guards dedup, rate limit 17 Apr 2026 closed by a bot not planned earlier, 31 Dec 2025, #15909: one command 300+ times, ~27M tokens
The loop was found on the bill (red) the next day; users shared guards (blue), and a bot closed the issue without a vendor reply (grey).

The steps to reproduce describe an unattended run. More than 100 MCP tools were configured, and the report says their definitions took "~33.4%" of the context window, with 42% used "before any conversation begins". The context ran out during a task; the user ran /compact, asked "Please finish the last task", then left. "Next day: the task is still running. Check the bill → $500+ spent on repeated requests."

The cause in the report is labelled a "Root Cause Hypothesis": after compaction the agent "Immediately runs out of context again" and "Retries", "repeating this loop indefinitely". The reporter asked for loop detection, "a maximum retry limit or cumulative cost guardrail for unattended sessions".

Other users replied with their own guards: a hook that "tracks the last N tool calls and aborts if it sees the same call repeated more than 3 times in a row", and a rate limit of "30 events per minute per user". The thread holds no reply from Anthropic. A bot closed it on 17 April 2026 as inactive, with the state "not planned". This is one user's report, with figures the vendor has not confirmed. An earlier report, #15909 (31 December 2025), describes a similar pattern: one npm install command run "300+ times" over "~4.6 hours", consuming "~27 million tokens".

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.