{"record":{"id":"2e062ebcfad0ed0a","repo":"langchain-ai/langchain","slug":"hasheddocument-is-an-internal-abstraction-that-wa","errorCode":null,"errorMessage":"_HashedDocument is an internal abstraction that was deprecated in  langchain-core 0.3.63. This abstraction is marked as private and  should not have been used directly. If you are seeing this error, please  update your code appropriately.","messagePattern":"_HashedDocument is an internal abstraction that was deprecated in  langchain-core 0\\.3\\.63\\. This abstraction is marked as private and  should not have been used directly\\. If you are seeing this error, please  update your code appropriately\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/indexing/api.py","lineNumber":244,"sourceCode":"        # Assign a unique identifier based on the hash.\n        id=hash_,\n        page_content=document.page_content,\n        metadata=document.metadata,\n    )\n\n\n# This internal abstraction was imported by the langchain package internally, so\n# we keep it here for backwards compatibility.\nclass _HashedDocument:\n    def __init__(self, *args: Any, **kwargs: Any) -> None:\n        \"\"\"Raise an error if this class is instantiated.\"\"\"\n        msg = (\n            \"_HashedDocument is an internal abstraction that was deprecated in \"\n            \" langchain-core 0.3.63. This abstraction is marked as private and \"\n            \" should not have been used directly. If you are seeing this error, please \"\n            \" update your code appropriately.\"\n        )\n        raise NotImplementedError(msg)\n\n\ndef _delete(\n    vector_store: VectorStore | DocumentIndex,\n    ids: list[str],\n) -> None:\n    \"\"\"Delete documents from a vector store or document index by their IDs.\n\n    Args:\n        vector_store: The vector store or document index to delete from.\n        ids: List of document IDs to delete.\n\n    Raises:\n        IndexingException: If the delete operation fails.\n        TypeError: If the `vector_store` is neither a `VectorStore` nor a\n            `DocumentIndex`.\n    \"\"\"\n    if isinstance(vector_store, VectorStore):","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/indexing/api.py#L226-L262","documentation":"`_HashedDocument` was a private helper in the indexing API that some users imported anyway. In langchain-core 0.3.63 its logic moved into `_get_document_with_hash` and the class was turned into a stub whose `__init__` always raises `NotImplementedError`. The class is kept importable purely so old imports do not break with an ImportError, but instantiating it is now a hard failure.","triggerScenarios":"`from langchain_core.indexing.api import _HashedDocument` followed by `_HashedDocument(...)`; older code or third-party packages (including some langchain-classic internals) that constructed it directly to pre-hash documents.","commonSituations":"Upgrading langchain-core past 0.3.63 with code that pre-hashed documents before calling index(); vendored tutorials or notebooks referencing the private class; CopyPasta from the indexing module's internals.","solutions":["Replace direct construction with a call to the public indexing API — `index()` hashes documents internally.","If you need a hashed document yourself, compute it via a callable passed as `key_encoder`, or hash content+metadata with hashlib in your own code.","Pin langchain-core < 0.3.63 only as a last-resort temporary stopgap while migrating."],"exampleFix":"# before\nhashed = _HashedDocument(page_content=doc.page_content)\n\n# after\n# let the indexer hash; or roll your own\nimport hashlib, uuid\nuid = uuid.uuid5(uuid.NAMESPACE_URL, doc.page_content)\nhashed = doc.model_copy(update={\"id\": str(uid)})","handlingStrategy":"try-catch","validationCode":"import langchain_core.indexing.api as api\nif hasattr(api, \"_get_document_with_hash\"):\n    ...  # new API available; do not touch _HashedDocument","typeGuard":null,"tryCatchPattern":"try:\n    hashed = _HashedDocument(...)  # legacy path\nexcept NotImplementedError:\n    hashed = None  # fall back to letting index() hash internally","preventionTips":["Never import underscore-prefixed names from langchain_core; they can be stubbed at any release.","Search your code and pinned third-party libs for '_HashedDocument' before upgrading langchain-core."],"tags":["indexing","deprecation","breaking-change","private-api"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}