fix: fail fast HNSW index when embedding dimension exceeds 2000#361
Merged
nicoloboschi merged 1 commit intovectorize-io:mainfrom Feb 26, 2026
Merged
Conversation
nicoloboschi
requested changes
Feb 13, 2026
Collaborator
nicoloboschi
left a comment
There was a problem hiding this comment.
we should raise the exception if pgvector can't handle that model
1 task
Instead of silently skipping HNSW index creation for embeddings > 2000 dimensions, raise a RuntimeError with an actionable message suggesting pgvectorscale/DiskANN as an alternative. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3d98097 to
9b4401a
Compare
Contributor
Author
|
Updated: now raises |
slayoffer
commented
Feb 16, 2026
nicoloboschi
approved these changes
Feb 26, 2026
r0gig0r
pushed a commit
to r0gig0r/hindsight
that referenced
this pull request
Feb 26, 2026
…nd customization Key upstream features: - Batch observations consolidation (vectorize-io#430) - multiple facts per LLM call - 18 new MCP tools + per-bank tool filtering (vectorize-io#435, vectorize-io#439) - retain_mission, observations_mission, reflect_mission customization (vectorize-io#419) - Disposition settings as hierarchical config (vectorize-io#419) - Graph memories filtering with tags (vectorize-io#431) - Observation invalidation on memory delete (vectorize-io#429) - Reflect agent improvements (vectorize-io#428) - Bank config API enabled by default (vectorize-io#426) - pgvector HNSW dimension limit check (vectorize-io#361) - Dynamic schema_getter for multi-tenant file storage (vectorize-io#440) Conflict resolution: - config.py: kept our tuned CONSOLIDATION_BATCH_SIZE=500 and MAX_TOKENS=1024 - consolidator.py, prompts.py, fact_extraction.py: took upstream (batch refactor) - orchestrator.py: removed obsolete bank_mission kwarg (now config-based) - Deleted test_consolidation_quality.py (tested removed _consolidate_with_llm) Our primary LLM fallback (claude-code + OpenRouter) preserved in all files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ensure_vector_extension()andensure_embedding_dimension()unconditionally create HNSW indexes at startup. pgvector's HNSW implementation has a hard limit of 2000 dimensions — any column with more dimensions causes aProgramLimitExceedederror:This crashes the application at startup for anyone using high-dimensional embeddings like OpenAI
text-embedding-3-large(3072 dimensions) with standard pgvector (not VChord).This was introduced by #350 and #355 which added VChord support and the
ensure_vector_extension()startup check.Fix
Before creating an HNSW index, check the embedding column dimension. If it exceeds 2000, log a warning and skip index creation — falling back to sequential scan, which works correctly at any dimension.
Applied in two places:
ensure_vector_extension()— queriespg_attribute.atttypmodper table to get the embedding dimensionensure_embedding_dimension()— uses the already-availablerequired_dimensionparameterContext
vchordrq) does not have this limitation — only the pgvector HNSW path is affectedTest plan
Skipping HNSW index on memory_units: embedding dimension 3072 exceeds pgvector HNSW limit of 2000 dims🤖 Generated with Claude Code