{"record":{"id":"ec6db24a3d55bcda","repo":"langchain-ai/langchain","slug":"trying-to-load-an-object-that-doesn-t-implement-se","errorCode":null,"errorMessage":"Trying to load an object that doesn't implement serialization: {value}","messagePattern":"Trying to load an object that doesn't implement serialization: (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/load/load.py","lineNumber":496,"sourceCode":"            [key] = value[\"id\"]\n            if key in self.secrets_map:\n                return self.secrets_map[key]\n            if self.secrets_from_env and key in os.environ and os.environ[key]:\n                return os.environ[key]\n            return None\n\n        if (\n            value.get(\"lc\") == 1\n            and value.get(\"type\") == \"not_implemented\"\n            and value.get(\"id\") is not None\n        ):\n            if self.ignore_unserializable_fields:\n                return None\n            msg = (\n                \"Trying to load an object that doesn't implement \"\n                f\"serialization: {value}\"\n            )\n            raise NotImplementedError(msg)\n\n        if (\n            value.get(\"lc\") == 1\n            and value.get(\"type\") == \"constructor\"\n            and value.get(\"id\") is not None\n        ):\n            [*namespace, name] = value[\"id\"]\n            mapping_key = tuple(value[\"id\"])\n\n            if (\n                self.allowed_class_paths is not None\n                and mapping_key not in self.allowed_class_paths\n            ):\n                msg = (\n                    f\"Deserialization of {mapping_key!r} is not allowed. \"\n                    \"The default (allowed_objects='core') only permits core \"\n                    \"langchain-core classes. To allow trusted partner integrations, \"\n                    \"use allowed_objects='all'. Alternatively, pass an explicit list \"","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/load/load.py#L478-L514","documentation":"Raised when the serialized payload contains a not_implemented marker (lc=1, type='not_implemented') — meaning the original object was dumped with skip_unserializable=True or otherwise replaced by a placeholder because it lacked serialization support — and the loader is asked to revive it. Loading cannot reconstruct the original object from the marker.","triggerScenarios":"dumps(obj, stop_unserializable=True) on an object graph containing non-Serializable nodes, then loads() on that output without flags; loading JSON where a field was replaced by {\"lc\": 1, \"type\": \"not_implemented\", \"id\": [...]} .","commonSituations":"Round-tripping chains that embed custom tools/retrievers without serialization support; consuming payloads produced by another service that skipped unserializable fields; partial migrations where some components never implemented to_json.","solutions":["Implement serialization for the offending class (subclass Serializable / add lc_attributes handling) and re-dump","Remove or replace the unsupported component in the object graph before dumping","Pre-process the payload to drop not_implemented entries if your loader can tolerate missing fields"],"exampleFix":"# before\njson_str = dumps(chain, stop_unserializable=True)\nchain2 = loads(json_str)  # NotImplementedError\n# after\njson_str = dumps(chain_with_only_serializable_parts)\nchain2 = loads(json_str)","handlingStrategy":"try-catch","validationCode":"import json\ndef has_not_implemented(node) -> bool:\n    if isinstance(node, dict):\n        if node.get('lc') == 1 and node.get('type') == 'not_implemented':\n            return True\n        return any(has_not_implemented(v) for v in node.values())\n    if isinstance(node, list):\n        return any(has_not_implemented(v) for v in node)\n    return False\nif has_not_implemented(json.loads(text)):\n    raise ValueError('payload contains not_implemented placeholders')","typeGuard":null,"tryCatchPattern":"try:\n    obj = loads(text)\nexcept NotImplementedError:\n    obj = loads(text)  # or: strip not_implemented nodes then retry / rebuild from scratch","preventionTips":["Avoid dumping with skip_unserializable=True if you intend to round-trip","Make every persisted component Serializable before saving workflows","Smoke-test the full dumps->loads round trip in CI for persisted objects"],"tags":["deserialization","serialization","not-implemented"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}