weaviate/weaviate · error

get vector: %w

Error message

get vector: %w

What it means

reVectorize() in usecases/modules/compare.go compares an incoming object against the stored embedding to decide if re-vectorization is needed; when a named targetVector is requested it extracts the stored vector via getVector(). This wrapper means extracting the stored named vector failed — typically because the stored vector has a Go type that is neither nil nor []float32.

Source

Thrown at usecases/modules/compare.go:54

	targetVector string,
	findObjectFn modulecapabilities.FindObjectFn,
	reVectorizeDisabled bool,
) (bool, models.AdditionalProperties, []float32, error) {
	if reVectorizeDisabled {
		return true, nil, nil, nil
	}

	shouldReVectorize, oldObject := reVectorizeEmbeddings(ctx, cfg, mod, object, class, sourceProperties, findObjectFn)
	if shouldReVectorize {
		return shouldReVectorize, nil, nil, nil
	}

	if targetVector == "" {
		return false, oldObject.AdditionalProperties, oldObject.Vector, nil
	} else {
		vector, err := getVector(oldObject.Vectors[targetVector])
		if err != nil {
			return false, nil, nil, fmt.Errorf("get vector: %w", err)
		}
		return false, oldObject.AdditionalProperties, vector, nil
	}
}

func getVector(v models.Vector) ([]float32, error) {
	switch vector := v.(type) {
	case nil:
		return nil, nil
	case []float32:
		return vector, nil
	default:
		return nil, fmt.Errorf("unrecognized vector type: %T", v)
	}
}

func reVectorizeMulti(ctx context.Context,
	cfg moduletools.ClassConfig,

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Ensure the module configured for the named target vector matches the vector's dimensionality/type stored for that vector (single vs multi-vector)
  2. Re-export and re-import affected objects, or rebuild the index, after changing a named vector's vectorizer module
  3. Check class.moduleConfig named-vector settings so multi-vector modules are only used with the multi-vector reVectorize path
  4. Update Weaviate if you hit this after an upgrade — it can indicate a migration bug; pin the failing objects and report it

Example fix

// before: named vector configured with multi-vector module but read via single-vector path
moduleConfig: {"named-vectors": {"vec": {"vectorizer": "multi2vec-clip"}}}
// after: use matching vectorizer type per named vector
moduleConfig: {"named-vectors": {"vec": {"vectorizer": "text2vec-openai"}}}
Defensive patterns

Strategy: type-guard

Validate before calling

// before update: confirm the named vector's stored type matches the module
if mv, ok := old.Vectors[targetVector].([][]float32); ok {
  return fmt.Errorf("named vector %q holds multi-vector data; use multi-vector module", targetVector)
}
if _, ok := old.Vectors[targetVector].([]float32); !ok && old.Vectors[targetVector] != nil {
  return fmt.Errorf("named vector %q has unexpected type", targetVector)
}

Type guard

func isSingleVector(v models.Vector) bool {
  _, ok := v.([]float32)
  return v == nil || ok
}

Try / catch

ok, props, vec, err := reVectorize(ctx, cfg, mod, obj, class, srcProps, tv, findFn, disabled)
if err != nil && strings.Contains(err.Error(), "get vector:") {
  return fmt.Errorf("named vector %q type mismatch, re-import data or fix moduleConfig: %w", tv, err)
}

Prevention

When it happens

Trigger: Object updates/imports on a class with named vectors where oldObject.Vectors[targetVector] holds a [][]float32 (multi-vector) or other type while the single-vector reVectorize path is used, i.e. the module expecting []float32 is reading a named vector written by a multi-vector module.

Common situations: Switching a named vector's module from a single-vector vectorizer to a multi-vector one (or vice versa) without re-importing; mixing legacy class.vectorizer code paths with named-vector data; internal state after partial migrations.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/9ffa736dab3e5183. Report an issue: GitHub.