langchain-ai/langgraph · error · InvalidNamespaceError

Namespace cannot be empty.

Error message

Namespace cannot be empty.

What it means

First check of the namespace validator _validate_namespace (shared by all BaseStore put/get/search calls): the namespace tuple is empty. Because namespaces are hierarchical paths ('('docs', 'user1')'), an empty tuple has no root label and cannot address any item, so it is rejected before any storage operation.

Solutions

  1. Pass at least one label, e.g. store.put(('memories', user_id), key, value)
  2. Derive namespaces from a stable root like ('docs', thread_id) so they are never empty
  3. Check for empty tuples from upstream logic (e.g. tuple(filter(...))) before calling the store
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/checkpoint/langgraph/checkpoint/store/base/__init__.py:1265 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/2ec990dc9e09e323. Report an issue: GitHub.

Appendix: source

Thrown at libs/checkpoint/langgraph/checkpoint/store/base/__init__.py:1265

def _validate_namespace(namespace: tuple[str, ...]) -> None:
    if not namespace:
        raise InvalidNamespaceError("Namespace cannot be empty.")
    for label in namespace:
        if not isinstance(label, str):
            raise InvalidNamespaceError(
                f"Invalid namespace label '{label}' found in {namespace}. Namespace labels"
                f" must be strings, but got {type(label).__name__}."
            )

View on GitHub (pinned to 38031739e5)