langchain-ai/langgraph · error · InvalidNamespaceError

Invalid namespace label

Error message

Invalid namespace label '{label}' found in {namespace}. Namespace labels must be strings, but got {type(label).__name__}.

What it means

Type check inside _validate_namespace: one element of the namespace tuple is not a str (its Python type name is shown). Namespaces are tuples of string labels; passing an int user id, a None, or a nested tuple as a label triggers this guard before the store operation runs.

Solutions

  1. Convert all labels to strings when building the namespace, e.g. ('memories', str(user_id))
  2. Avoid None or nested structures inside namespace tuples
  3. Validate dynamic namespace parts (ids from APIs, DBs) with map(str, parts) before calling put/get
Defensive patterns

Strategy: type-guard

When it happens

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

Appendix: source

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

    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__}."
            )
        if "." in label:
            raise InvalidNamespaceError(
                f"Invalid namespace label '{label}' found in {namespace}. Namespace labels cannot contain periods ('.')."
            )

View on GitHub (pinned to 38031739e5)