{"record":{"id":"e65a78f740943a03","repo":"langchain-ai/deepagents","slug":"offload-server-returned-a-non-object-response","errorCode":null,"errorMessage":"Offload server returned a non-object response.","messagePattern":"Offload server returned a non-object response\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/client/remote_client.py","lineNumber":432,"sourceCode":"                    thread_id=thread_id,\n                    operation_id=operation_id,\n                )\n            except NotFoundError as exc:\n                # The route itself is missing. An unregistered thread cannot\n                # reach here as a 404: the server catches that and answers 409\n                # with its own message. A custom `graph_ref` server, or one\n                # older than this operation, never registers the dcode HTTP app,\n                # and the SDK's bare \"404 Not Found\" names neither the cause nor\n                # a fix.\n                msg = (\n                    \"This server does not provide dcode's /offload operation. \"\n                    \"Use the built-in dcode server, or upgrade the server to a \"\n                    \"version that registers it.\"\n                )\n                raise RuntimeError(msg) from exc\n            if not isinstance(response, dict):\n                msg = \"Offload server returned a non-object response.\"\n                raise TypeError(msg)\n            status = response.get(\"status\")\n            if status == \"complete\":\n                return _validated_offload_result(response.get(\"result\"))\n            request = response.get(\"request\")\n            if status != \"interrupt\" or not is_hook_interrupt_payload(request):\n                msg = \"Offload server returned an invalid operation response.\"\n                raise RuntimeError(msg)\n            invocation = request.get(\"request\")\n            invocation_id = (\n                invocation.get(\"invocation_id\")\n                if isinstance(invocation, dict)\n                else None\n            )\n            if not isinstance(invocation_id, str) or not invocation_id:\n                msg = \"Offload hook request has no invocation id.\"\n                raise RuntimeError(msg)\n            logger.debug(\n                \"Offload round %d fulfilling hook invocation %s\",","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/client/remote_client.py#L414-L450","documentation":"After the offload POST succeeds at the transport level, `aoffload` expects the response body to be a JSON object (dict). If the server returns a non-dict payload (list, string, number, null), the client raises this TypeError because it cannot read `status`/`request`/`result` from it. This is a server/client protocol fault, not something the caller's input caused.","triggerScenarios":"The `/dcode/threads/{thread_id}/offload` route (or an intermediary) returns a non-object body: a bare JSON array or string, an error page, or an unexpected serialization from a mismatched server version.","commonSituations":"A proxy or gateway replacing the JSON body with an HTML/string error; running a server whose offload response schema predates the client's; a custom reimplementation of the route returning a differently shaped payload.","solutions":["Verify server and client versions match — upgrade or downgrade so both speak the same offload protocol.","Inspect the raw response (curl the endpoint or check server logs) to see what non-object body is actually returned.","Remove/reconfigure intermediaries (proxies, gateways) that might rewrite the response body.","If you operate a custom server, fix the route to return `{\"status\": ...}`-shaped JSON objects."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def is_offload_response(value: object) -> bool:\n    return isinstance(value, dict)","tryCatchPattern":"try:\n    result = await agent.aoffload(config=config, context=ctx, fulfill_hook=hook)\nexcept TypeError as exc:\n    if \"non-object response\" in str(exc):\n        logging.error(\"Offload endpoint returned a non-JSON-object body; check server/proxy\")\n    else:\n        raise","preventionTips":["Keep server and client versions matched to the same offload protocol.","Bypass or audit proxies that rewrite JSON bodies on internal routes.","Log raw responses when integrating against a custom offload implementation."],"tags":["protocol","schema","offload","server-response"],"backgroundTag":"invalid-server-response-shape","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}