CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P)· Lessons

    Domain 7 · Lesson 38/38

    Claude Code errors, automatic retries and session recovery

    Support debugging and operational issue resolution

    10 min read
    2.33% of exam
    5 sources
    Published 19 Oct 2026
    Docs as of 14 Oct 2026

    What you will be able to do

    • Sort a Claude Code error message into its category before deciding what to do
    • Predict which failures Claude Code retries on its own and which need action from you
    • Recover a session from autocompact thrashing without losing the investigation
    • Get past a refusal and find a stuck or looping agent in a multi-agent session

    1.Sort the error into a category before acting

    A Claude Code error message usually tells you which category it belongs to, and the category decides your next move. The error reference groups messages into server errors, usage limits, authentication, network, request errors, command-line errors, plugin errors and tool errors. Deciding the category first keeps you from the most expensive mistake: retrying something that will never succeed, or rewriting a prompt to fix what was really an outage.

    Error categories, a typical message in each, and what the category tells you
    CategoryExample messageWhat it tells you
    Server errorsAPI Error: Repeated 529 Overloaded errorsAnthropic-side trouble; often transient
    Usage limitsYou've hit your session limitYour quota or spend cap is used up; retrying won't help until it resets
    AuthenticationNot logged in · Please run /loginCredentials are missing or expired; the message names the fix
    NetworkUnable to connect to APIThe path between you and the API is broken: connectivity, proxy or certificates
    Request errorsContext limit reached · /compact or /clear to continueThe request itself has to change before it can succeed
    Command-line errors--bg and --print conflictThe way Claude Code was invoked is wrong; fix the flags

    The HTTP status codes underneath follow the same split. A 529 overloaded_error means the API is temporarily overloaded. A 429 rate_limit_error can mean a rate limit or a reached spend cap. A 400 invalid_request_error means the request's format or content is wrong. If a failure persists and you need support, include the request ID from the error: every API response carries one.

    Checkpoint 1 of 6· Match them up

    Match each Claude Code error message to what its category tells you to do next.

    Tap a term, then the definition that fits it.

    Sources1

    2.What Claude Code retries for you, and what it won't

    Claude Code retries failures that are transient and that happen before any useful output exists. Server errors, overloaded responses and request timeouts that arrive before any of Claude's response has streamed are retried with backoff. So are dropped connections, including one broken because your computer went to sleep. Temporary 429 throttles are retried too. A message like Waiting for API response · will retry in means this is already happening, and you should wait instead of intervening.

    Some retries are deliberately capped:

    • Stalled stream: a response stream that stalls before any response arrives is aborted and streamed again at most once.
    • Error after thinking: a server error that arrives after Claude finishes thinking but before any text or tool call is retried up to two times.
    • Content filter: a response stopped by the output content filter is re-sent once. A second block shows Output blocked by content filtering policy.

    Everything that needs a change from you stays failed. A spend-cap 429 has no retry-after header and keeps failing until access resumes. Authentication and request errors name their own fix, such as /login or /compact or /clear. Waiting longer won't clear either kind.

    Checkpoint 2 of 6· Check yourself

    Your session shows an error and you're deciding whether to step in or let Claude Code handle it. Which of these situations will Claude Code recover from by itself if you just wait?

    Sources21

    3.Recovering from context pressure and autocompact thrashing

    Compaction summarizes earlier conversation history to free room in the context window; the mechanics are in Compaction (server-side and client-side SDK). Compaction can fail in a loop. If the context fills back to the limit straight after compacting, three times in a row, Claude Code stops with an "Autocompact is thrashing" error instead of burning more API calls. That error tells you something specific: whatever keeps refilling the window is still in the conversation, so compacting or retrying again won't help.

    The fix is to stop the refill at its source. A typical case is reading a 40,000-line log in one go. Work through these steps in order:

    1. Ask Claude to read the oversized file in smaller chunks, such as a specific line range or function.
    2. Run /compact with a focus that drops the large output, for example /compact keep only the plan and the diff.
    3. Move the large-file work to a subagent, so it runs in a separate context window.
    4. Run /clear, but only if the earlier conversation is no longer needed.

    Each step costs something different, so check what you are giving up. A focused /compact keeps only what you name, and anything else, like earlier hypotheses, survives only as summary. /clear drops the whole conversation, which is a poor trade in the middle of an investigation where the reasoning so far still matters. After recovering, check /context. If Messages is the largest row, some output is refilling the window again. If the other rows together are larger, what loads at startup leaves too little room, so trim it. /compact can also return Not enough messages to compact. even when the context is full, if a single large paste filled it.

    Checkpoint 3 of 6· Check yourself

    Midway through an investigation, you ask Claude Code to read a 40,000-line service log in one go. The session then stops with "Autocompact is thrashing." You still need the reasoning built up so far. What should you do first?

    Checkpoint 4 of 6· Exam question

    During a long debugging session, Claude Code raises "Autocompact is thrashing: the context refilled to the limit..." immediately after automatic compaction completes, and it stops retrying. The team was asking Claude to read an entire 40,000-line production log file to find the root cause of an outage. What is the most effective way to recover and continue the investigation?

    Sources34

    4.Recovering a session that stalled on a refusal

    A refusal blocks the conversation from the turn that triggered it. Why the model refuses is covered under built-in safety classifiers and refusal fallback. Recovering means getting back to a point before that turn. Press Esc twice or run /rewind to return to a checkpoint before the triggering turn, then rephrase or take a different approach. If you can't tell which turn caused it, /clear starts a fresh conversation in the same project. The old conversation stays on disk and is still available in /resume.

    Headless runs need a different path, because rewind isn't available under -p. Retry with a rephrased prompt in a new session without --continue. Policy checks vary by model, so --model can sometimes help as well. Sometimes the trigger is in a customization rather than your prompt. If the message shows Details: [reasoning_extraction], look for an instruction telling Claude to write out its reasoning verbatim, which may sit in CLAUDE.md, a skill or an MCP tool description. To confirm, send the same prompt in a claude --safe-mode session. After you change the customization, start a new session.

    Checkpoint 5 of 6· Check yourself

    A refusal arrives with "Details: [reasoning_extraction]". You suspect the trigger is a customization, not your prompt. Which step confirms that?

    Sources2

    5.Finding the stuck or looping agent in a multi-agent session

    When a multi-agent session stops making progress, first find which agent is stuck before deciding what to do. How spans and traces work is covered under reading a trace: spans across a run and its subagents. Claude Code tags each claude_code.tool OTEL span with agent_id and parent_agent_id, and background subagent spans nest under the Agent tool span that dispatched them. Follow those IDs down the tree. The agent whose span stays open, or that keeps producing the same tool calls, is the one stuck or looping.

    You can see the same tree without a tracing backend. /agents shows the nested subagent tree as work fans out, with a descendant count on each row and a path back to main. Runaway nesting has a ceiling: subagent chains are capped at five levels deep. Once you've found the stuck agent, press Ctrl+C to try to cancel the current operation. If the session doesn't respond, close the terminal and restart.

    Checkpoint 6 of 6· Check yourself

    The /agents tree points to one subagent that keeps making the same tool calls. You press Ctrl+C to cancel the current operation, but the session stays frozen and doesn't respond to input. What is the next step?

    Sources354

    Sources

    (5)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “529 - overloaded_error: The API is temporarily overloaded.”
      ↩︎ Sort the error into a category before acting
      “When contacting support about a specific request, include this ID to help quickly resolve your issue.”
      ↩︎ Sort the error into a category before acting
      “A tier spend-cap 429 has no retry-after header and keeps failing until access resumes”
      ↩︎ What Claude Code retries for you, and what it won't
      “A tier spend-cap 429 has no retry-after header and keeps failing until access resumes”
      ↩︎ Exam trap 2
    2. 2.
      “Server errors, overloaded responses, and request timeouts that arrive before any of Claude’s response has streamed.”
      ↩︎ What Claude Code retries for you, and what it won't
      “Claude Code aborts the stalled connection and streams the request again at most once.”
      ↩︎ What Claude Code retries for you, and what it won't
      “If you can’t identify which turn caused it, run /clear to start a fresh conversation in the same project.”
      ↩︎ Recovering a session that stalled on a refusal
      “Your previous conversation is preserved on disk and remains available in /resume.”
      ↩︎ Recovering a session that stalled on a refusal
      “Policy checks vary by model, so switching to a different model with --model may also resolve the refusal in some cases.”
      ↩︎ Recovering a session that stalled on a refusal
      “Context limit reached · /compact or /clear to continue | Request errors”
      ↩︎ Checkpoint
      “Temporary 429 throttles, but not a gateway’s spend-limit 429, which isn’t a throttle”
      ↩︎ Prediction
      “Claude Code detects was broken by your computer going to sleep partway through a request. Claude Code counts it as a dropped connection”
      ↩︎ Checkpoint
    3. 3.
      “now detects when context refills to the limit immediately after compacting three times in a row and stops with an actionable error”
      ↩︎ Recovering from context pressure and autocompact thrashing
      “Added agent_id and parent_agent_id attributes to claude_code.tool OTEL spans”
      ↩︎ Finding the stuck or looping agent in a multi-agent session
      “now detects when context refills to the limit immediately after compacting three times in a row and stops with an actionable error”
      ↩︎ Exam trap 1
    4. 4.
      “Ask Claude to read the oversized file in smaller chunks, such as a specific line range or function, instead of the whole file”
      ↩︎ Recovering from context pressure and autocompact thrashing
      “Move the large-file work to a subagent so it runs in a separate context window”
      ↩︎ Recovering from context pressure and autocompact thrashing
      “If it returns Not enough messages to compact., the conversation has too few turns to summarize”
      ↩︎ Recovering from context pressure and autocompact thrashing
      “Press Ctrl+C to attempt to cancel the current operation”
      ↩︎ Finding the stuck or looping agent in a multi-agent session
      “Restart with claude --safe-mode to check whether a plugin, MCP server, or hook is the source. It disables all customizations for the session”
      ↩︎ Checkpoint
      “If unresponsive, you may need to close the terminal and restart”
      ↩︎ Checkpoint
    5. 5.
      “Subagent chains are capped at five levels deep to prevent runaway concurrent trees.”
      ↩︎ Finding the stuck or looping agent in a multi-agent session

    Ready to test yourself?

    Practise the 12 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.