{"record":{"id":"eaa1754882be755c","repo":"langchain-ai/langgraph","slug":"object-of-type-type-obj-is-not-json-serializabl","errorCode":null,"errorMessage":"Object of type {type(obj)} is not JSON serializable","messagePattern":"Object of type (.+?) is not JSON serializable","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/sdk-py/langgraph_sdk/_shared/utilities.py","lineNumber":91,"sourceCode":"    is_class = isinstance(obj, type)\n    if hasattr(obj, \"model_dump\") and callable(obj.model_dump):\n        if is_class:\n            raise TypeError(\n                f\"Cannot JSON-serialize type object: {obj!r}. Did you mean to pass an instance of the object instead?\"\n                f\"\\nReceived type: {obj!r}\"\n            )\n        return obj.model_dump()\n    elif hasattr(obj, \"dict\") and callable(obj.dict):\n        if is_class:\n            raise TypeError(\n                f\"Cannot JSON-serialize type object: {obj!r}. Did you mean to pass an instance of the object instead?\"\n                f\"\\nReceived type: {obj!r}\"\n            )\n        return obj.dict()\n    elif isinstance(obj, (set, frozenset)):\n        return list(obj)\n    else:\n        raise TypeError(f\"Object of type {type(obj)} is not JSON serializable\")\n\n\n# Compiled regex pattern for extracting run metadata from Content-Location header\n_RUN_METADATA_PATTERN = re.compile(\n    r\"(\\/threads\\/(?P<thread_id>.+))?\\/runs\\/(?P<run_id>.+)\"\n)\n\n\ndef _get_run_metadata_from_response(\n    response: httpx.Response,\n) -> RunCreateMetadata | None:\n    \"\"\"Extract run metadata from the response headers.\"\"\"\n    if (content_location := response.headers.get(\"Content-Location\")) and (\n        match := _RUN_METADATA_PATTERN.search(content_location)\n    ):\n        return RunCreateMetadata(\n            run_id=match.group(\"run_id\"),\n            thread_id=match.group(\"thread_id\") or None,","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/sdk-py/langgraph_sdk/_shared/utilities.py#L73-L109","documentation":"Error \"Object of type {type(obj)} is not JSON serializable\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/sdk-py/langgraph_sdk/_shared/utilities.py:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}