langchain-ai/langgraph · error · ValueError

EmbeddingsLambda was initialized with an async function but…

Error message

EmbeddingsLambda was initialized with an async function but no sync function. Use aembed_documents for async operation or provide a sync function.

What it means

Runtime guard in EmbeddingsLambda.embed_documents (also hit via embed_query): the wrapper was constructed with an async function only, so self.func is unset and no synchronous embedding path exists. The class stores async callables under self.afunc and sync callables under self.func; calling the sync API on an async-only instance hits the getattr(self, 'func', None) -> None branch and raises this error.

Solutions

  1. Call the async API instead: await embeddings.aembed_documents(texts) / aembed_query(text)
  2. Provide a synchronous embedding function so sync calls work
  3. Run the async path via asyncio.run(...) when only an event loop is absent
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at libs/checkpoint/langgraph/checkpoint/store/base/embed.py:176 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26). Data as JSON: /api/errors/20fa876486e101cb. Report an issue: GitHub.

Appendix: source

Thrown at libs/checkpoint/langgraph/checkpoint/store/base/embed.py:176

        func = getattr(self, "func", None)
        if func is None:
            raise ValueError(
                "EmbeddingsLambda was initialized with an async function but no sync function. "
                "Use aembed_documents for async operation or provide a sync function."
            )
        return func(texts)

View on GitHub (pinned to 38031739e5)