Skip to content

fix: recognize Valkey Search's missing-index error in exists() - #775

Closed
sarankumar1325 wants to merge 1 commit into
redis:mainfrom
sarankumar1325:fix/773-valkey-missing-index-wording
Closed

sarankumar1325 wants to merge 1 commit into
redis:mainfrom
sarankumar1325:fix/773-valkey-missing-index-wording

Conversation

@sarankumar1325

@sarankumar1325 sarankumar1325 commented Oct 19, 2026 •

Copy link
Copy Markdown

Motivation

Fixes #773.

Since #672, exists() decides that an index is missing by matching the FT.INFO error against _MISSING_INDEX_ERROR_FRAGMENTS. Valkey Search (for example Amazon ElastiCache for Valkey 9.1) words that error as Index with name '<name>' not found in database <n>, which matches none of the fragments ("index not found" doesn't match because the name sits between "Index" and "not found"). So on Valkey, exists() raises RedisSearchError instead of returning False, and create() (which calls exists() first) never creates the index. That breaks, for example, langgraph-checkpoint-redis setup on a fresh Valkey database.

Changes

  • redisvl/exceptions.py: add "not found in database" to _MISSING_INDEX_ERROR_FRAGMENTS, with a comment naming the Valkey Search wording. Matching still reads the underlying Redis error (__cause__), so the existing protection against an index named after a wording is unchanged.
  • tests/unit/test_index_exists.py: add the Valkey wording to MISSING_INDEX_MESSAGES, so test_missing_index_wording_returns_false covers it (fails on main, passes with the change).
  • docs/api/exceptions.rst: list the Valkey Search wording alongside the Redis ones.

I went with the smaller of the two fixes suggested in the issue (adding the wording) rather than an FT._LIST fallback, since it keeps #672's least-privilege behaviour and the existing "match known wordings, re-raise everything else" design.

Review record

  • Reviewed commit: a7394f6. Prepared with an AI coding assistant; I reviewed the diff.
  • Angles: correctness (the new fragment is only checked against the Redis error, not the wrapper; permission/connection errors still raise per NON_MISSING_INDEX_ERRORS), tests, docs.
  • Commands: uv run pytest tests/unit/test_index_exists.py: 14 passed. uv run pytest tests/unit --ignore=tests/unit/test_mcp: same result with and without this change apart from the new case (local failures/errors in test_google_genai_vectorizer.py, test_cli_*, and test_repr.py come from my environment, e.g. missing optional deps, and also happen on main). black --check, isort --check, mypy redisvl/exceptions.py: clean.
  • Not checked: I had no Docker, so I ran the unit tests with the session Redis container fixture stubbed out locally (not committed), and did not run integration tests. I didn't test against a live Valkey server; the wording comes from the issue report.

Note

Low Risk
Narrow addition to known missing-index message fragments with existing tests and docs; non-missing errors remain re-raised.

Overview
Fixes Valkey Search so SearchIndex.exists() treats Valkey’s missing-index FT.INFO reply as “not present” instead of raising RedisSearchError.

Valkey reports absences as Index with name '<name>' not found in database <n>, which did not match the existing Redis-only message fragments (the index name sits between “Index” and “not found”), so exists() failed and create() could not run on a fresh Valkey DB.

The PR adds the fragment "not found in database" to _MISSING_INDEX_ERROR_FRAGMENTS (still matched on __cause__ so permission/connection errors are unchanged), extends unit tests with the Valkey wording, and documents it in docs/api/exceptions.rst.

Reviewed by Cursor Bugbot for commit a7394f6. Bugbot is set up for automated code reviews on this repo. Configure here.

Valkey Search answers FT.INFO for an absent index with
"Index with name '<name>' not found in database <n>", which matched none
of the known wordings, so exists() raised instead of returning False and
create() never created the index.

Fixes redis#773
Copilot AI balanced review requested due to automatic review settings October 19, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vishal-bala

Copy link
Copy Markdown
Collaborator

Hi, thanks for the PR! Support for Valkey Search isn't actually a goal for this project - it's focused on enabling users to build on Redis. Adding support for all of the various forks of Redis would end up bloating the project. I'm going to close this PR as out of scope, but we appreciate you taking the time to put this together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exists() depends on exact FT.INFO error wording; an unrecognised "missing index" message makes create() never create the index (regression from #672)

3 participants