langchain-ai/langgraph · error · ValueError

Invalid index parameter value for

Error message

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

What it means

Raised while parsing pgvector index parameters in _get_index_params: the value supplied for an allowed parameter key (e.g. 'm', 'ef_construction', 'lists'/'nlist') could not be converted to an integer by int(). This means the index_config dict passed to the Postgres store contains a non-numeric value (string like 'abc', None, a list, etc.) for one of the recognized tuning keys.

Solutions

  1. Set every pgvector index tuning parameter to an integer, e.g. index_config={"kind":"hnsw","m":16,"ef_construction":64}
  2. If you copied config from JSON/YAML, cast values explicitly with int() before constructing the store
  3. Remove the offending key from index_config; unknown keys are silently ignored, but known keys with bad values raise
Defensive patterns

Strategy: validation

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.

Appendix: 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)