{"record":{"id":"1fcafe7ec12910b1","repo":"langchain-ai/langgraph","slug":"number-of-embeddings-len-embeddings-does-not","errorCode":null,"errorMessage":"Number of embeddings ({len(embeddings)}) does not match number of indices ({len(indices)})","messagePattern":"Number of embeddings \\((.+?)\\) does not match number of indices \\((.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/checkpoint/langgraph/checkpoint/store/memory/__init__.py","lineNumber":453,"sourceCode":"    def _insertinmem_store(\n        self,\n        to_embed: dict[str, list[tuple[tuple[str, ...], str, str]]],\n        embeddings: list[list[float]],\n    ) -> None:\n        indices = [index for indices in to_embed.values() for index in indices]\n        if len(indices) != len(embeddings):\n            raise ValueError(\n                f\"Number of embeddings ({len(embeddings)}) does not\"\n                f\" match number of indices ({len(indices)})\"\n            )\n        for embedding, (ns, key, path) in zip(embeddings, indices, strict=False):\n            self._vectors[ns][key][path] = embedding","sourceCodeStart":null,"sourceCodeEnd":null,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/checkpoint/langgraph/checkpoint/store/memory/__init__.py#L453","documentation":"Internal invariant check in InMemoryStore._insertinmem_store: after embedding texts collected during a batch PUT, the count of vectors returned by the embedding call does not equal the number of (namespace, key, path) index slots that were queued for embedding. This is not a user-input error per se — it signals the embedding function violated its contract (returned a different number of vectors than input texts), or duplicated-text deduplication bookkeeping diverged.","triggerScenarios":"Thrown at libs/checkpoint/langgraph/checkpoint/store/memory/__init__.py:453 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the custom embedding function to return exactly one vector per input text (len(output) == len(texts))","If using EmbeddingsLambda, verify the wrapped function's return shape is list[list[float]]","Update langgraph-checkpoint if running an old version with an embedding dedup bug"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","contentChangedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}