langchain-ai/deepagents · error · RuntimeError

Offload server completed without a typed result.

Error message

Offload server completed without a typed result.

What it means

`_validated_offload_result` type-checks the offload server's result; if the completed result is not a `dict`, it raises `RuntimeError` because no typed `OffloadResult` payload was produced. This is a protocol fault indicating the server finished the offload/compaction but returned an unexpected (non-object) body.

Source

Thrown at libs/code/deepagents_code/client/remote_client.py:133

    """Check a server offload result before any caller indexes it.

    The renderer subscripts these fields by key and unguarded. Validating here
    means a protocol skew fails with a message naming the problem, instead of a
    `KeyError` reported as a generic reporting failure for an offload the server
    already committed.

    Args:
        result: The `result` object from a `complete` operation response.

    Returns:
        The same mapping, once its required fields are known to be present.

    Raises:
        RuntimeError: If a required field is missing or has the wrong type.
    """
    if not isinstance(result, dict):
        msg = "Offload server completed without a typed result."
        raise RuntimeError(msg)  # noqa: TRY004  # protocol fault, not a type misuse
    status = result.get("status")
    if not isinstance(status, str) or not status:
        msg = "Offload result has no status."
        raise RuntimeError(msg)
    # Statistics are only meaningful (and only read) for a committed compaction.
    if status == "compacted":
        for field in _OFFLOAD_RESULT_INT_FIELDS:
            value = result.get(field)
            if not isinstance(value, int) or isinstance(value, bool):
                msg = (
                    f"Offload result field {field!r} must be an integer, got "
                    f"{type(value).__name__}."
                )
                raise RuntimeError(msg)  # noqa: TRY004  # protocol fault
    return cast("OffloadResult", result)


def _require_thread_id(config: Mapping[str, Any] | None) -> str:

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Verify server health/logs for why the offload completed without a result object.
  2. Align client and server versions so the offload response schema matches.
  3. Inspect the raw response body to confirm what the server actually returned.
  4. Retry the offload; if reproducible, file a server-side protocol bug.

Example fix

// before: server returns bare result list
return [items]
// after: return the typed envelope
return {"status": "compacted", "items": items}
Defensive patterns

Strategy: type-guard

Validate before calling

def looks_like_offload_result(result) -> bool:
    return isinstance(result, dict) and isinstance(result.get("status"), str) and bool(result["status"])
# pre-check before calling APIs that consume the result
assert looks_like_offload_result(raw), "offload returned no typed result"

Type guard

from typing import TypeGuard
def is_offload_result(result: object) -> TypeGuard[dict]:
    return isinstance(result, dict) and isinstance(result.get("status"), str) and bool(result["status"])

Try / catch

try:
    result = await aoffload(...)
except RuntimeError as exc:
    if "without a typed result" in str(exc):
        inspect_raw_response_and_retry()

Prevention

When it happens

Trigger: `aoffload` completes and passes the raw result to `_validated_offload_result`, but the deserialized response is `None`, a list, a string, etc., instead of a JSON object.

Common situations: Server error pages or empty bodies being deserialized to `None`; client/server version drift changing the response envelope; serialization bugs on the server returning a bare array.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/f0283220c31f4416. Report an issue: GitHub.