weaviate/weaviate · error
target vector is not a string, got %v
Error message
target vector is not a string, got %v
What it means
Each element of the targetVectors array must be a string naming a vector configured on the collection. If an element is not a string (number, null, nested list), ExtractTargets rejects it with this error, printing the offending element.
Source
Thrown at adapters/handlers/graphql/local/common_filters/extract_targets.go:39
targets, ok := source["targets"]
if ok {
targetsGql, ok := targets.(map[string]interface{})
if !ok {
return nil, nil, fmt.Errorf("targets is not a map, got %v", targets)
}
targetVectorsGQL, ok := targetsGql["targetVectors"]
if !ok {
return nil, nil, fmt.Errorf("targetVectors is required field, got %v", targets)
}
targetVectorsArray, ok := targetVectorsGQL.([]interface{})
if !ok {
return nil, nil, fmt.Errorf("targetVectors is not an array, got %v", targetVectorsGQL)
}
targetVectors := make([]string, len(targetVectorsArray))
for i, value := range targetVectorsArray {
targetVectors[i], ok = value.(string)
if !ok {
return nil, nil, fmt.Errorf("target vector is not a string, got %v", value)
}
}
combinationType, ok := targetsGql["combinationMethod"]
targetCombinationType := dto.DefaultTargetCombinationType
if ok {
targetCombinationType, ok = combinationType.(dto.TargetCombinationType)
if !ok {
return nil, nil, fmt.Errorf("combinationMethod is not a TargetCombinationType, got %v", combinationType)
}
}
weightsGQL, ok := targetsGql["weights"]
var weightsIn map[string]interface{}
if ok {
weightsIn = weightsGQL.(map[string]interface{})
}
View on GitHub (pinned to 75aa4b6d11)
Solutions
- Ensure every entry is the string name of a configured named vector.
- Un-wrap over-nested arrays so each element is a plain string.
- Cross-check names against the collection schema (named vector configuration).
Example fix
// before
targets: { targetVectors: [["title_vector"]] }
// after
targets: { targetVectors: ["title_vector"] } Defensive patterns
Strategy: type-guard
Validate before calling
targets.targetVectors.forEach(v => { if (typeof v !== 'string') throw new Error('targetVectors entries must be strings: ' + JSON.stringify(v)); }); Type guard
function isNamedVectorList(v) { return Array.isArray(v) && v.length > 0 && v.every(x => typeof x === 'string' && x.length > 0); } Try / catch
try { ... } catch (e) { if (String(e).includes('target vector is not a string')) { console.error('Fix targetVectors entries to plain strings'); } throw e; } Prevention
- Cross-check vector names against the collection schema.
- Do not interpolate numbers or nested arrays into targetVectors.
- Validate the payload shape in CI with a small schema check.
When it happens
Trigger: targetVectors containing non-string entries, e.g. [1, 2], [null], or [["title_vector"]] from over-nesting in client query variables.
Common situations: Auto-generated query builders that interpolate numeric vector IDs; copy/paste errors nesting the array twice; passing enum values that serialize as numbers.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- targets is not a map, got %v
- targetVectors is not an array, got %v
- weight for target %s is not a float or list of floats, got %
- could not extract objectLimit: %w
- no groupBy must be a list, instead got: %#v
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/c200e8ade7d4a04e.
Report an issue: GitHub.