langchain-ai/langgraph · error · ValueError

Invalid index parameter value for {k}: {v}

Error message

Invalid index parameter value for {k}: {v}

What it means

Error "Invalid index parameter value for {k}: {v}" thrown in langchain-ai/langgraph.

Source

Thrown at libs/checkpoint-postgres/langgraph/store/postgres/base.py:1270

            f"Invalid index kind for pgvector: {kind}. Expected 'hnsw', 'ivfflat', or 'flat'."
        )

    raw.pop("vector_type", None)

    if kind == "hnsw":
        allowed_keys = {"m", "ef_construction"}
    else:  # ivfflat/flat
        allowed_keys = {"lists", "nlist"}

    sanitized: dict[str, int] = {}
    for k, v in list(raw.items()):
        if k not in allowed_keys:
            continue
        key = "lists" if k == "nlist" else k
        try:
            ivalue = int(v)  # type: ignore[call-overload]
        except Exception as e:
            raise ValueError(f"Invalid index parameter value for {k}: {v}") from e
        if ivalue <= 0:
            continue
        sanitized[key] = ivalue

    return kind, sanitized


def _namespace_to_text(namespace: tuple[str, ...]) -> str:
    """Convert namespace tuple to text string."""
    return ".".join(namespace)


def _escape_like_literal(text: str) -> str:
    """Escape LIKE metacharacters so `text` is matched literally.

    Namespace labels may contain `_` and `%`, which would otherwise act as
    wildcards: `("user_1",)` would match `("userX1",)`. Backslash is escaped
    first so it cannot escape the following character. Requires an explicit

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/checkpoint-postgres/langgraph/store/postgres/base.py:1270 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/a0345c01029608d9. Report an issue: GitHub.