Tool error handling — CCA-F Exam Prep

PencilPrepPencilPrep
L2.07|Tool error handling
1/12
Real story
A developer's phone at 3:14 AM showing a PagerDuty alert: 'CRITICAL: API spend $200 in 2 minutes. Agent loop detected.' Behind it, a laptop screen showing 47 identical failed API calls in a log viewer. Each line: '500 Internal Server Error.' Red everywhere.

A payment API went down for 90 seconds. Claude retried 47 times. Cost: $200.

A fintech startup had a Claude-powered agent that processed refunds. Tuesday at 3am, the payment gateway returned a 500 error. The agent's tool call failed. So Claude did what it was designed to do: try to accomplish the task.

It called the tool again. 500. Again. 500. 47 times in 2 minutes. Each call included the full conversation context -- system prompt, user message, all 46 previous failures. Tokens compounding with every retry.

The payment API was down for 90 seconds. The cleanup took 3 weeks.