Skip to content

fix: validate LanceDB vector dimensions before batch writes#2414

Closed
yinli-systems wants to merge 1 commit into
microsoft:mainfrom
yinli-systems:kevin/fix-embedding-batch-vectors
Closed

fix: validate LanceDB vector dimensions before batch writes#2414
yinli-systems wants to merge 1 commit into
microsoft:mainfrom
yinli-systems:kevin/fix-embedding-batch-vectors

Conversation

@yinli-systems

@yinli-systems yinli-systems commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Fixes #2265 by validating each LanceDB document vector against the configured vector_size before constructing the PyArrow fixed-size-list column.

When the embedding model returns vectors with a different dimension than the configured LanceDB index, the current code reaches FixedSizeListArray.from_arrays(...) and fails later with a confusing row-count-style Arrow error such as Column 1 named vector expected length 44 but got length 11. This change fails earlier with the exact document id, actual vector dimension, index name, and configured vector size.

Tests

  • UV_CACHE_DIR=/private/tmp/uv-cache-graphrag uv run pytest -q tests/integration/vector_stores/test_lancedb.py -k "load_documents"
  • UV_CACHE_DIR=/private/tmp/uv-cache-graphrag uv run pytest -q tests/integration/vector_stores/test_lancedb.py
  • UV_CACHE_DIR=/private/tmp/uv-cache-graphrag uv run ruff format --check packages/graphrag-vectors/graphrag_vectors/lancedb.py tests/integration/vector_stores/test_lancedb.py
  • UV_CACHE_DIR=/private/tmp/uv-cache-graphrag uv run ruff check packages/graphrag-vectors/graphrag_vectors/lancedb.py tests/integration/vector_stores/test_lancedb.py

@yinli-systems yinli-systems requested a review from a team as a code owner June 24, 2026 01:00
@gaudyb

gaudyb commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixed in PR #2442

@gaudyb gaudyb closed this Jul 16, 2026
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.

[Bug]: Pipeline error: Column 1 named vector expected length 44 but got length 11

2 participants