weaviate/weaviate · error
object: inconsistent vector lengths found: dimensions=%d and
Error message
object: inconsistent vector lengths found: dimensions=%d and object=%d
What it means
vectorsToMatrix flattens the object vector and its neighbors' vectors into one dense matrix of width dims. Before copying, it checks the object's vector length equals the expected dims derived from params; otherwise the flattened buffer would be misaligned. The error reports both lengths.
Source
Thrown at modules/text2vec-contextionary/additional/sempath/builder.go:165
return nn[0].Neighbors, nil
}
// TODO: document behavior if it actually stays like this
func (pb *PathBuilder) vectorsToMatrix(obj search.Result, allObjects []search.Result, dims int,
params *Params, searchNeighbors []*txt2vecmodels.NearestNeighbor,
) (*mat.Dense, []*txt2vecmodels.NearestNeighbor, error) {
items := 1 // the initial object
var neighbors []*txt2vecmodels.NearestNeighbor
neighbors = pb.extractNeighbors(allObjects)
neighbors = append(neighbors, searchNeighbors...)
neighbors = pb.removeDuplicateNeighborsAndDollarNeighbors(neighbors)
items += len(neighbors) + 1 // The +1 is for the search vector which we append last
// concat all vectors to build gonum dense matrix
mergedVectors := make([]float64, items*dims)
if l := len(obj.Vector); l != dims {
return nil, nil, fmt.Errorf("object: inconsistent vector lengths found: dimensions=%d and object=%d", dims, l)
}
for j, dim := range obj.Vector {
mergedVectors[j] = float64(dim)
}
withoutNeighbors := 1 * dims
for i, neighbor := range neighbors {
neighborVector := neighbor.Vector
if l := len(neighborVector); l != dims {
return nil, nil, fmt.Errorf("neighbor: inconsistent vector lengths found: dimensions=%d and object=%d", dims, l)
}
for j, dim := range neighborVector {
mergedVectors[withoutNeighbors+i*dims+j] = float64(dim)
}
}View on GitHub (pinned to 75aa4b6d11)
Solutions
- Re-vectorize the object so its dimensions match params.Dims
- Ensure all objects in the collection use the same vectorizer/model settings (fix moduleConfig)
- Check where params dimensions are set for semanticPath and make them consistent with the stored vectors
Defensive patterns
Strategy: validation
Validate before calling
dims := len(params.Vector)
if len(obj.Vector) != dims {
return fmt.Errorf("object vector dim %d != expected %d; re-vectorize", len(obj.Vector), dims)
} Type guard
func hasDims(v []float32, dims int) bool { return len(v) == dims } Prevention
- Never change vectorizer/model settings without re-vectorizing the whole collection
- Check all stored vector lengths are equal after migrations
- Use one dimensionality per collection
When it happens
Trigger: semanticPath computation where the search result's object vector length differs from params.Dims (or similar) — e.g. the collection was re-vectorized with a different model producing different dimensions than the params/neighbor vectors assume.
Common situations: Mixed-dimension vectors in one collection after changing vectorizer settings; legacy objects from an older contextionary version alongside new ones.
Related errors
- neighbor: inconsistent vector lengths found: dimensions=%d a
- item %d has no vector
- object %d: %w
- have different output results than input %d != %d
- failed to get bucket
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/888ef1c33a46a533.
Report an issue: GitHub.