Retry and failure cost measures resources spent on unsuccessful AI attempts before a task is completed. In IDE workflows, failed attempts may produce no error code: a subtly wrong refactor, a missed edge case, and a successful third attempt can consume three full agent sessions. section 9.1
Track the hidden cost through:
- Average attempts per successful task; one team recorded 1.7 prompting attempts. section 9.1
- Context growth across attempts, as developers add error messages, failing tests, and additional files. section 9.1
- Wasted tokens that cost more than the tokens producing the final answer. section 9.1
Three sessions for one refactor
A refactor returns subtly wrong, a second attempt misses an edge case, and a third attempt succeeds. Although no API error occurs, the first two sessions still consume paid model context and developer attention. section 9.1
Figure 9.1 The Cost Iceberg - visible subscriptions and API spend vs. hidden costs in AI-assisted development.

The cost iceberg places retry waste below visible subscriptions and API spend, alongside other hidden production costs. section 9.1
