🎓 Claude Certification Prep

Home › CCDV-P › M04

Advanced Debugging and Incident Response

Domain 4 10% of exam 48 practice questions ~17 min read

Isolating complex failures (multi-turn, multi-agent, non-deterministic) among model output, agent harness, tools, and data; handling refusals and retrieval-grounding failures; reproducing with replay, repeated runs, and bisection; incident response (triage, rollback, fallback, communication) and turning incidents into regression evals, monitoring coverage, and blameless postmortems.

Skills measured in this domain:
  • Complex Failure Diagnosis (multi-turn, multi-agent, non-deterministic): model output vs harness vs tools vs data; refusals, retrieval-grounding failures
  • Incident Response and Learning Loops: triage, mitigation, rollback, communication; turning incidents into regression evaluations, monitoring, and postmortems

Domain overview

Domain 4 accounts for 10% of the CCDV-P exam (about 6 of the 60 scored items) and covers two skills: Complex Failure Diagnosis and Incident Response and Learning Loops. Items usually present a trace, a log snippet, or an incident timeline, and then ask "where does the failure originate?", "what should you do first?", or "which step closes the learning loop?".

Skill What items often test Reflexes you need
Complex failure diagnosis Reading a trace to find the first point of error; refusals; retrieval misses vs. answer-generation failures; reproducing non-deterministic failures Check the input actually sent to the model before blaming the model; measure the rate across many runs
Incident response & learning loops Triage by error code, version rollback, fallback, communication, regression evals, postmortems Limit the damage first, find the root cause later; every incident becomes an eval and a monitoring signal

The lesson from two public Anthropic postmortems: overlapping changes produce symptoms that look like "the model randomly got worse".

Complex failure diagnosis

Isolating the origin: model, harness, tool, or data

The most effective approach is to walk the trace backwards: starting from the final answer, look at the input of the last anthropic.model_request, then the tool results, the tool arguments, and the earlier decisions. The first point where the data is already wrong is where the failure originates.

Origin Signs in the trace Example Fix direction
Model output The input is complete and correct, but the model picks the wrong tool, invents parameters, or answers in contradiction to the tool result it has Calls tool A instead of B because of a vague description; parameters not in the schema Describe tools in terms of when to use them; strict: true; input_examples; fix the prompt
Agent harness The request sent differs from what was intended: missing history, lost thinking, a new system prompt, a changed default effort; message formatting errors tool_use ids were found without tool_result blocks immediately after; comparing raw JSON strings of tool input Diff the request bodies between the good and the bad version; fix the harness, parse JSON instead of comparing strings
Tool Tool span ERROR (error.type=tool_error), claude_code.tool.execution with success=false, timeouts An internal API returns 500, returned data is malformed Fix the tool; return clear errors so the model can handle them
Data / retrieval Tool arguments look reasonable but the tool result lacks the needed information Stale index, chunks that lost their context Fix the retrieval pipeline (see below)

There is also the model-serving infrastructure layer: Anthropic's August–September postmortem describes a context-window routing error, a TPU misconfiguration that produced unexpected characters, and an XLA:TPU compiler bug. To users, this layer looks like "a model bug", so you need data broken down by platform and time to tell them apart.

Two easily confused cases in the tool-use troubleshooting guide:

  • Claude refuses to act on a tool result or asks the user for clarification: usually because your instructions are inside tool_result, which Claude treats as potentially untrusted third-party content; move the instructions into the user turn after the tool_result block.
  • After a model upgrade, string comparisons on tool input fail because Unicode and / escaping differ between versions: a harness bug, fixed with json.loads()/JSON.parse().

Key point

"The model is wrong" is the final conclusion, not the first hypothesis. First confirm that the model received the correct input (history, thinking, tool results, system prompt, parameters), because many "quality drop" incidents are really changes in the harness or the infrastructure.

Multi-turn and multi-agent failures

Anthropic's post on its multi-agent research system names three characteristics that make debugging hard:

  • Compounding errors: agents keep state across many tool calls; one broken step can push the agent onto a completely different trajectory. When an error occurs, resume from a checkpoint instead of restarting from the beginning.
  • Non-determinism between runs, even with identical prompts. When users report that the agent "can't find obvious information", only full production tracing tells you whether the cause was poor queries, poor sources, or tool failures; Anthropic monitors the agents' decision patterns without reading conversation content.
  • Coordination failures: early agents spawned 50 subagents for simple questions or searched endlessly for sources that didn't exist. Vague task descriptions cause subagents to duplicate or miss work; each subagent needs a clear objective, output format, tool/source guidance, and boundaries.

When you deploy a new version, running agents can be at any step, so Anthropic uses rainbow deployments: traffic shifts gradually to the new version while the old version keeps running. In Claude Code traces, subagent spans nest under the parent agent's claude_code.tool, which lets you compare the task description handed over with what the subagent actually did.

Scenario example

Claude Code's April 23 postmortem: a change meant to clear old thinking for sessions idle for more than an hour had a bug and cleared thinking on every turn after that. Symptoms: Claude seemed forgetful and repetitive; every request was a cache miss, so usage limits ran out quickly. This was a harness bug at the intersection of context management, the API, and extended thinking, occurring only in a corner case. It passed code review, unit tests, end-to-end tests, and dogfooding; two unrelated changes also masked the bug in most CLI sessions, so it could not be reproduced at first. Evidence in the trace: cache_read falls to near 0 on every turn after the idle point, and thinking from earlier turns disappears from the request.

Refusals as a distinct failure class

A refusal returns HTTP 200 with stop_reason: "refusal", so it does not raise the error rate. With Claude Fable 5, stop_details describes the classifier category (cyber, bio, frontier_llm, reasoning_extraction), but it is informational only and can be null (treat it as a generic refusal). Branch your logic on stop_reason, not on content or stop_details.

Signal Classification Correct response
200, stop_reason: "refusal" Refusal (classifier block or model decline) Don't resend unchanged; switch to a fallback model and flag it so the router stays on the fallback
200, stop_reason: "max_tokens" Truncated answer Raise max_tokens or split the task
200, Claude asks for clarification about instructions in a tool result The instructions are treated as prompt injection Move the instructions out of tool_result
429/5xx/529 API error Retry with backoff; see the triage section
# Sketch: branch on stop_reason, not on content
if resp.stop_reason == "refusal":
    details = resp.stop_details              # may be None
    category = details.category if details else "generic"
    log_refusal(category)                    # refusal rate SLI
    resp = call_fallback(messages, model="claude-opus-4-8")  # don't resend unchanged

Fallback details (Fable 5 cookbook):

  • Resending the same request after a refusal just gets refused again, because the blocked content is still in the conversation history.
  • Server-side fallback: fallbacks: [{"model": "claude-opus-4-8"}] with the beta header server-side-fallback-2026-06-01. If the fallback model cannot run, the turn is still a refusal and stop_details.recommended_model names the model to try.
  • Server-side fallback is not yet available on Amazon Bedrock, Vertex AI, Microsoft Foundry, or the Message Batches API; there, use the SDK's refusal-fallback middleware.
  • Multi-agent systems: every call from every agent, subagents included, needs fallback configured; when one agent is refused, only that agent switches to the fallback model.

Exam trap

Common wrong answers: retrying in a loop on the same model after a refusal; detecting refusals by searching for strings in content; assuming stop_details always has a category; configuring fallback only for the orchestrator and forgetting the subagents; using the error rate to monitor refusals.

Retrieval-grounding failures

A wrong answer in a RAG system has two different sources, and the fixes are completely different:

  1. Retrieval miss: the needed passage is not in the retrieval results (check anthropic.tool_result.content or the retriever's logs). Fix it in the pipeline: query, chunking, index, ranking. Contextual Retrieval reduces retrieval failures by 49%, and by 67% when combined with reranking.
  2. Ungrounded generation: the right passage is already in the context, but the answer contradicts it or adds information not in the source. Fix it on the generation side: allow Claude to say "I don't know", require direct quotes before answering, enable citations, restrict answers to the provided documents, and verify with Best-of-N.

Reproducing non-deterministic failures

  • You can't "set temperature to 0 to reproduce": Claude 4.7 and newer models return an error for any temperature other than the default of 1.0. Reproducing therefore means the same input + many runs + measuring the rate.
  • Capture the exact input: Full content on spans, or Claude Code's OTEL_LOG_RAW_API_BODIES=file:<dir> (full bodies, with thinking always redacted). Replay the saved request instead of reconstructing it from the user's description.
  • Measure as a rate: run N times; pass@k (at least one success) differs from pass^k (success on all k runs, 0.75³ ≈ 42%).
  • Control the environment: on Terminal-Bench 2.0, resource configuration alone produced a 6-percentage-point difference (p < 0.01), and pass rates fluctuated with the time of day; treat differences under 3 points with skepticism.
  • Bisect changes: list every change in the time window (prompt, model/alias, tools, harness, default effort, infrastructure) and toggle each one. For system prompts, use ablation (removing one line at a time) on a broad eval suite: ablation is exactly what revealed the length-limit line that caused a 3% drop on Opus 4.6 and Opus 4.7.
  • Masked bugs: the December 2024 workaround for temperature 0 masked the approximate top-k bug; the bug changed with the surrounding computations and with whether debugging tools were enabled. Anthropic reduced it to a minimal reproducer and compared it with correct results on CPU.

Exam trap

"It was correct when rerun once, so it isn't a bug" and "set temperature to 0 and compare" are both wrong. For non-deterministic failures, the evidence is the failure rate across many runs of the same input, in a controlled environment.

Key point

A good reproduction includes: the exact request (replay), enough runs to see a rate, a recorded environment (serving model, platform, resources), and a single change toggled between the two groups.

(Sources: Claude Docs: Troubleshooting tool use; Anthropic Engineering: How we built our multi-agent research system; Anthropic Engineering: An update on Claude Code quality reports; Claude Cookbooks: Classifier Fallback & Billing; Anthropic Engineering: Contextual retrieval in AI systems; Anthropic Engineering: Infrastructure noise in agentic coding evals)

Incident response & learning loops

Triage

The first three questions: what is broken (availability, cost, quality, refusals), who is affected (model, platform, version, tenant), and since when (check against the change calendar). Error codes help you classify quickly:

Signal Meaning First response
429 rate_limit_error with retry-after Rate limit reached Back off; the SDK retries automatically (2 times by default) and honors retry-after
429 without retry-after The usage tier's spend cap is reached; requests will keep failing until access is restored Retrying is pointless; deal with the spend limit
429 with error.details.error_code = ramp_limit_exceeded Usage increased too sharply (ramp limit) Ramp up load gradually
400 due to a spend limit The organization/workspace spend limit you set has been reached Adjust the limit
529 overloaded_error The API is temporarily overloaded across the board Back off, reduce load
500 api_error / 504 timeout_error Internal error / timeout Retry with backoff; use streaming for long requests; contact support with the request-id

With streaming, errors can occur after a 200 has already been returned. In Claude Code, api_error is emitted only after retries run out (CLAUDE_CODE_MAX_RETRIES defaults to 10). Quality incidents have no error code: you need cohort analysis by version and platform, and a look at the per-user distribution ("sticky" routing means some users are affected repeatedly).

Mitigation: limit the damage first, root cause later

  • Roll back along each dimension: prompts, model IDs, tool definitions, and harness configuration are all versioned so you can revert each one separately. Anthropic reverted the default effort, reverted the system-prompt line about length, rolled back the TPU configuration, and switched to exact top-k despite a slight performance cost.
  • Fallback routing: for refusals, use server-side fallback or the SDK middleware as above; every fallback path needs to be evaluated in advance, not in the middle of an incident.
  • Separate diagnosis from remediation: the SRE agent cookbook has the agent only investigate first, then remediate in a separate step, because production may require a human to approve the diagnosis; a PreToolUse hook checks write operations. The control band works the same way: 2σ is read-only diagnosis, and only at 3σ do you act through a reviewed PR or a pre-approved runbook.
  • Safer deployment: soak periods, broader evals, and gradual rollout for changes that may trade off intelligence.

Exam tip

When the item asks what to do first during an ongoing incident, prefer quick, reversible actions limited to exactly the affected scope (roll back the most suspicious change, enable fallback). Rewriting the prompt, changing the architecture, or waiting for a complete root cause come afterwards.

Scenario example

On Tuesday the team releases prompt v12; on Wednesday, complaints about overly short answers increase. Triage: the failures appear only in the prompt v12 cohort, across all models. Mitigation: roll back to v11 (cheap and reversible) and communicate the scope. Then ablate each new line of v12 on a broad eval suite, add the reproducing case to the regression suite, and re-release through a gradual rollout.

Communication

Good communication states the scope, the impact, the workaround, and the time of the next update, even before the root cause is known. Anthropic created @ClaudeDevs on X and consolidated threads on GitHub, reset usage limits for all subscribers, and thanked users who sent /feedback or reproducible examples; feedback through /bug and thumbs down is treated as a signal that helps isolate the bug. When contacting support, include the request-id.

Turning incidents into a learning loop

  1. Regression eval: every production incident gets an eval written by the team that owns the incident, which stays in the suite as a regression test (it must pass at close to 100%). Leading indicator: time from incident to a fixed eval.
  2. Monitoring coverage: add signals that catch the exact signature of the failure. After the unexpected-character incident, Anthropic added detection tests for output with abnormal characters to its deployment process; after the routing bug, they started running quality evals continuously on real production.
  3. Process improvements: staff use the exact public build; per-model evals for every system prompt change; tooling to review prompt changes; changes intended for one model apply only to that model. A Code Review back-test on the PR that caused the bug: Opus 4.7, given enough repository context, found the bug, while Opus 4.6 did not.
  4. Postmortem: written so that the organization, not an individual, learns.

Structure of a good postmortem

Section Content Example from Anthropic's postmortems
Summary and commitment What happened, who was affected, the commitment Three infrastructure bugs; a statement that quality is never reduced because of demand or time of day
Background How the system operates Serving through the API, Amazon Bedrock, and Vertex AI on multiple hardware types
Timeline Milestones with specific dates Aug 5 routing bug; Aug 25–26 two deployments; Aug 29 load-balancing change
Each issue Cause, quantified impact, fix Routing: 0.8% rising to 16% in the worst hour; about 30% of Claude Code users had at least one message affected
Why it was hard to detect Gaps in evals, signals, process Evals missed it because Claude recovers on its own; privacy controls; symptoms differed by platform
Upcoming changes Concrete actions More sensitive evals, continuous evals on production, debugging tools that don't sacrifice privacy

A blameless postmortem focuses on the system: the faulty change had passed several layers of review and testing, so the corrective actions are improvements to review tooling, evals, and rollout, not tracking down who wrote the code.

Key point

An incident is truly closed only when you have all of: a regression eval that reproduces the failure, a monitoring signal that will catch it if it comes back, and a postmortem with action items that each have an owner.

Exam trap

Common wrong answers: a postmortem that names the person who caused the bug; only adding unit tests when the real gap is detection in production; closing the incident right after a hotfix with no eval; waiting for the full root cause before rolling back.

(Sources: CCDV-P Exam Guide, Domain 4; Claude Docs: Claude API errors; Claude Docs: Rate limits; Anthropic Engineering: A postmortem of three recent issues; Anthropic Engineering: An update on Claude Code quality reports; Claude Cookbooks: Claude Agent SDK — The SRE Incident Response Agent; Anthropic Academy: The AI-native SDLC playbook — Continuous evals in CI, Closing the loop on metrics)

Quick summary

  • Walk the trace backwards to find the first point where the data is wrong; classify the origin: model output, harness, tool, data (plus the serving infrastructure).
  • Check the input actually sent to the model before concluding "the model is worse"; many quality incidents are harness changes.
  • Instructions placed in tool_result can be treated as prompt injection; JSON escaping differs between model versions, so parse instead of comparing strings.
  • Multi-agent systems: errors compound and runs are non-deterministic even with the same prompt; you need full production tracing, checkpoints, clear task descriptions, and rainbow deployments.
  • Refusal = HTTP 200 + stop_reason: "refusal"; stop_details can be null; resending unchanged will be refused again.
  • Fallback must be configured for every agent, subagents included; server-side fallback is not available on Bedrock, Vertex AI, Foundry, or Batches.
  • Separate retrieval misses (the passage was not retrieved) from answer-generation failures (the passage is there but the answer is wrong).
  • Claude 4.7 and later do not accept a temperature other than 1.0: reproduce by replaying the exact request, running it many times, measuring the rate, and controlling the infrastructure.
  • Bisect each change; ablate the system prompt one line at a time on a broad eval suite.
  • Triage by error code: 429 with/without retry-after, ramp_limit_exceeded, 529, 500/504; with streaming, errors can arrive after a 200.
  • Limit the damage first (reversible rollback, fallback), root cause later; separate read-only diagnosis from approved remediation.
  • Every incident becomes a regression eval written by the owning team, a new monitoring signal, and a blameless postmortem with action items.