Skip to content
Claude Certified Developer – Foundations (CCDV-F) Exam Prep

Lesson 25 of 25 · 7 min

x
25/25

Debugging and Error Handling

Video lesson: CCDV-F 25/25: Debugging and Error Handling (Domain 4, 2.6%)

Official scope (Exam Guide v1.0): error type identification, recovery strategy selection, trace analysis, isolating the problem origin between the integration layer and the model output.

Error types

StatusTypeRetry?
400invalid_request_error (also: a spend limit you set; model-specific validation such as prefill, sampling params, forced tool choice)No: fix the request
401authentication_error (bad, revoked, expired key)No
402billing_errorNo
403permission_errorNo
404not_found_errorNo
409conflict_errorAfter resolving the conflict
413request_too_large (32 MB Messages)No: shrink or use Files API
429rate_limit_errorYes, honour retry-after; except the spend-cap 429 (no retry-after, enforced_spend_limit_reached)
500api_errorYes, backoff
504timeout_errorYes; prefer streaming or batch for long requests
529overloaded_errorYes, backoff

SDKs retry transient errors twice by default. Streaming errors can arrive after a 200. Always log the request-id.

"Bad answer" is often a stop reason

max_tokens (truncated), refusal (a 200), unhandled tool_use, pause_turn not continued, model_context_window_exceeded, empty end_turn after text was added behind tool_result. Check stop_reason before blaming the prompt.

Recovery strategy selection (design guidance)

Retry transient errors with backoff and jitter (capped) · fix and resend request faults · fall back (smaller model, other model on refusal, cached answer, standard speed after a fast-mode 429) · repair malformed output (retry with the validation error fed back) · escalate to a human.

Trace analysis (design guidance)

Read the run in order: requests, tool calls with inputs and outputs, stop reasons, token usage, latency, and the transcript. Find the first step where reality diverged from intent. In Claude Code and the Agent SDK, hooks and OpenTelemetry export can capture this.

Isolate the origin (design guidance)

Replay the exact request in isolation: - Payload wrong (missing history, wrong tools, bad parameters, parsing bug, dropped thinking blocks) → integration fault; fix the code. - Payload right, answer still wrong → prompt or model issue; go to the eval set and iterate.

Evals catch what unit tests miss (verified principle)

Non-deterministic output needs eval sets that mirror real traffic plus edge cases (empty, very long, hostile, ambiguous input). Grading: exact match, code checks, similarity, or model-graded rubrics; grade with clear criteria, check the grader on a sample, prefer many automated cases. Re-run after every prompt, tool or model change.

Exam traps

  • Retrying a 400.
  • Retrying a spend-cap 429 forever.
  • Blaming the model for a truncation or an integration bug.
  • Green unit tests = working feature.
  • No request id in logs.

References

  1. Errors — checked Oct 16, 2026
  2. Rate limits — checked Oct 16, 2026
  3. Handling stop reasons — checked Oct 16, 2026
  4. Define success criteria and build evaluations — checked Oct 16, 2026
  5. Observability with OpenTelemetry (Agent SDK) — checked Oct 16, 2026

Check your understanding

  • Retry 429 or 400?Show answer

    Answer

    429 (with backoff); 400 is a request fault.
  • Answers cut off mid-sentence. First check?Show answer

    Answer

    stop_reason (max_tokens).
  • The replayed request shows the tool results were never appended. Origin?Show answer

    Answer

    Integration layer.
  • Unit tests pass, users report wrong answers. Why?Show answer

    Answer

    Tests do not reflect real inputs; use evals on realistic and edge cases.

Next step: take a CCDV-F practice exam

You have reached the end of the course. Take practice exam 1 without notes, check your score by domain, then go back to the lessons for your weakest domain before the next exam. There are 10 exams with 530 questions in all, and every answer is explained.

Previous

Progress is saved in this browser.

Finish Course