Skip to content

fix(db): error on embedding dimension mismatch#20

Open
echobt wants to merge 1 commit intoCortexLM:mainfrom
echobt:fix/embedding-dim-mismatch
Open

fix(db): error on embedding dimension mismatch#20
echobt wants to merge 1 commit intoCortexLM:mainfrom
echobt:fix/embedding-dim-mismatch

Conversation

@echobt
Copy link
Copy Markdown
Contributor

@echobt echobt commented Jan 20, 2026

When the embedding model changes after indexing, stored chunk embeddings can have a different dimensionality than the query embedding. Previously this was silently treated as 0.0 similarity, producing confusing 0% scores.

This change detects dimension mismatches (and corrupt embedding blobs) during search and returns a clear error suggesting reindexing via: vgrep index --force.

A unit test covers the mismatch case.

Validation:

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test

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.

1 participant