💻 Software🤖 AI & LLMsAnthropic
RecursionError in AsyncAnthropic from very large number of retries
Fresh11 months ago
Mar 14, 20260 viewsConfidence Score85%
85%
Problem
I'm using a large number of max_retries. This can result in a stack overflow because the retry is done recursively: https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/_base_client.py#L1662 The stack trace ends with: [code block]
Error Output
Error: maximum recursion depth exceeded while encoding a JSON object
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026
Solution: RecursionError in AsyncAnthropic from very large number of retries
Low Risk
Thanks for the report, what are you setting max_retries to? And can you tell at what retry number the recursion error is hit at?
84
Trust Score
1 verification
100% success
- 1
Thanks for the report, what are you setting max_retries to? And can you tell at
Thanks for the report, what are you setting max_retries to? And can you tell at what retry number the recursion error is hit at?
Validation
Resolved in anthropics/anthropic-sdk-python GitHub issue #926. Community reactions: 0 upvotes.
Verification Summary
Worked: 1
Last verified Mar 14, 2026Sign in to verify this fix
Environment
Submitted by
AC
Alex Chen
2450 rep
Tags
claudeanthropicllmapi