0Pricing
Claude Architect · Lektion

Wiederholbare Metadaten und Teilergebnisse

errorCategory, isRetryable, attempted_query, partials

Wiederholbare Metadaten und Teilergebnisse ist eine kostenlose Claude Architect-Lektion auf CoddyKit. Dies ist Lektion 3 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Claude Architect-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Claude Architect-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Why Error Shape Matters

When a tool or MCP server fails, the model has to decide what to do next. A generic status like "Operation failed" gives it nothing to reason about, so the only safe move is to abort or guess.

A structured error turns a dead end into a decision: should we retry, route around the failure, or escalate to a human? In this lesson you'll learn the four metadata fields that make that possible: errorCategory, isRetryable, attempted_query, and partial_results.

The isError Flag

Every structured MCP error starts with one boolean: isError: true. This is the unambiguous signal that the tool result is a failure, not data.

Without it, the model may treat an error message as a legitimate answer and happily summarize the failure as if it were a result. The flag is the gate that activates all the recovery logic that follows.

tool_result = {
    "isError": True,
    "errorCategory": "transient",
    "isRetryable": True,
    "message": "Upstream timeout contacting orders DB",
    "attempted_query": "SELECT * FROM orders WHERE id='A-2291'",
    "partial_results": []
}

errorCategory: Four Buckets

errorCategory classifies why the call failed so the model can route intelligently. The four standard categories are:

  • transient — a temporary fault (timeout, rate limit). Likely worth retrying.
  • validation — the input was malformed. Fix the request, don't blindly retry.
  • business — a domain rule blocked it (e.g. order already shipped).
  • permission — the caller isn't authorized. Retrying won't help; escalate or re-auth.

The category drives the strategy; it doesn't make the decision alone.

isRetryable: The Action Hint

isRetryable is the explicit yes/no on whether retrying could possibly succeed. It works with the category but encodes a sharper signal.

A transient timeout is usually isRetryable: true. A validation error is isRetryable: false — retrying the same bad input just fails again. Crucially, this lets the subagent recover transient faults locally instead of bubbling every hiccup up to the coordinator.

if result.get("isError"):
    if result["isRetryable"] and attempt < max_attempts:
        attempt += 1
        continue          # recover locally in the subagent
    else:
        escalate(result)  # non-recoverable: pass it up with context

Don't Confuse Failure with Empty

A subtle but exam-critical distinction: an access FAILURE is not the same as a valid EMPTY result.

  • isError: true + transient → the query couldn't run. Consider a retry.
  • isError: false + empty list → the query ran fine and there are genuinely no matches. Retrying is pointless and wasteful.

Generic errors blur this line. Structured metadata keeps "I couldn't look" cleanly separated from "I looked, nothing's there."

attempted_query: Make Retry Possible

attempted_query records exactly what the tool tried to do — the SQL, the API call, the search string. This serves two jobs:

  • It lets the model retry with feedback: send the original intent plus the error so a corrected query can be formed.
  • It feeds provenance — you keep a claim-to-source trail of what was actually asked.

Remember: retry-with-feedback fixes format/structural mistakes. If the information is simply absent from the source, no amount of re-querying helps.

{
    "isError": True,
    "errorCategory": "validation",
    "isRetryable": True,
    "message": "Unknown column 'order_no'; did you mean 'order_id'?",
    "attempted_query": "SELECT * FROM orders WHERE order_no='A-2291'",
    "partial_results": []
}

partial_results: Don't Throw Away Good Data

When a multi-step or multi-source operation fails halfway, the work done before the failure is still valuable. partial_results carries it forward.

Imagine a research subagent that queried five sources and the fifth timed out. Returning the four successful results plus the error means the coordinator can keep going — instead of discarding everything because one leg failed. Never abort the whole workflow on a single failure.

{
    "isError": True,
    "errorCategory": "transient",
    "isRetryable": True,
    "message": "Source 5 (vendor API) timed out after 4 of 5 sources",
    "attempted_query": "fetch pricing from [s1..s5]",
    "partial_results": [
        {"source": "s1", "price": 19.0},
        {"source": "s2", "price": 21.5},
        {"source": "s3", "price": 18.9},
        {"source": "s4", "price": 20.0}
    ]
}

Recover Locally, Escalate with Context

The metadata enables a clean two-tier strategy in hub-and-spoke systems:

  • Recover transient faults locally inside the subagent — retry the isRetryable ones quietly.
  • Escalate non-recoverable failures up to the coordinator, carrying the full structured context: failure type, attempted query, and any partial results.

The coordinator handles errors and routes. But it can only route well if the subagent hands it a structured signal instead of a bare exception or silence.

Designing the Error Schema

If you define the error as structured output, apply the schema rules carefully. Mark a field required only if it is always present. partial_results is often empty or absent on a hard failure — so don't force it as required, or the model may fabricate entries to satisfy the schema.

For errorCategory, use an enum with an "other" value plus a free-text detail field. That keeps classification clean today and extensible for failure modes you haven't met yet.

error_schema = {
    "type": "object",
    "properties": {
        "isError": {"type": "boolean"},
        "errorCategory": {
            "enum": ["transient", "validation",
                     "business", "permission", "other"]
        },
        "categoryDetail": {"type": "string"},
        "isRetryable": {"type": "boolean"},
        "attempted_query": {"type": "string"},
        "partial_results": {"type": "array"}
    },
    "required": ["isError", "errorCategory", "isRetryable"]
}

Hooks for the Failures That Cost Money

Metadata guides the model probabilistically (~90%). When a failure has financial, legal, or safety consequences, that isn't enough.

Use a PostToolUse hook to intercept the tool result before the model sees it, and enforce policy deterministically (100%). For example: if errorCategory is permission on a refund tool, block any retry and force escalation — don't leave it to the prompt to behave.

# PostToolUse hook: deterministic guard on structured errors
def post_tool_use(result):
    if result.get("isError") and \
       result["errorCategory"] == "permission":
        return block_and_escalate(
            reason=result["message"],
            attempted=result["attempted_query"])
    return result

Anti-Pattern: Silent Suppression

The worst thing you can do with a failure is hide it. Two failure modes to avoid:

  • Silent suppression — swallowing the error and returning an empty or made-up result. Now the model can't tell a real "no matches" from a broken query.
  • Aborting the whole workflow on one failed leg — throwing away every partial result.

Structured errors are the cure for both: they surface the failure and preserve what succeeded.

Quick Check: Routing a Partial Failure

Apply what you've learned to a real multi-agent scenario.

Recap: The Recovery Toolkit

Structured errors turn failures into routable decisions:

  • isError — the gate that activates recovery logic.
  • errorCategory — transient / validation / business / permission (+ "other") sets the strategy.
  • isRetryable — the explicit retry hint; recover transient faults locally.
  • attempted_query — enables retry-with-feedback and provenance (won't help if info is truly absent).
  • partial_results — carry forward good data; never abort the whole workflow on one failure.

Mark only always-present fields as required, guard money/legal/safety failures with deterministic hooks, and never suppress errors silently. That's architect-grade error handling.

Häufig gestellte Fragen

Ist die Lektion „Wiederholbare Metadaten und Teilergebnisse“ kostenlos?

Ja — der vollständige Text von „Wiederholbare Metadaten und Teilergebnisse“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Claude Architect-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Claude Architect-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Wiederholbare Metadaten und Teilergebnisse“?

errorCategory, isRetryable, attempted_query, partials Du übst Claude Architect mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Claude Architect zu starten?

Keine Vorkenntnisse erforderlich. Claude Architect auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 3 von 4.

Wie lange dauert die Lektion „Wiederholbare Metadaten und Teilergebnisse“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Claude Architect-Lektion Code schreiben und ausführen?

Ja. Jede Claude Architect-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Das isError-Flag
  2. Fehlerkategorien
  3. Wiederholbare Metadaten und Teilergebnisse
  4. Anti-Pattern: Allgemeine Fehlermeldungen
← Zurück zu Claude Architect