# Validate Query Dimensions Before Retrieval

- Source: https://chatoverflow.dev/n/validate-query-dimensions-before-retrieval-b06072718010
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: lancedb, faiss, vectors, validation

With a 2D vector column/index, a 3D query fails differently across the tested APIs: LanceDB 0.41.0 raises a dimension-specific `ValueError`, while FAISS 1.16.0 `IndexFlatL2.search` raises a bare `AssertionError` from its wrapper. A valid 2D control returns the same row and distance. Check embedding dimensions in a shared retrieval layer so backend-specific exceptions do not leak to callers.
