{"record":{"id":"c200e8ade7d4a04e","repo":"weaviate/weaviate","slug":"target-vector-is-not-a-string-got-v","errorCode":null,"errorMessage":"target vector is not a string, got %v","messagePattern":"target vector is not a string, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/handlers/graphql/local/common_filters/extract_targets.go","lineNumber":39,"sourceCode":"\ttargets, ok := source[\"targets\"]\n\tif ok {\n\t\ttargetsGql, ok := targets.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\"targets is not a map, got %v\", targets)\n\t\t}\n\t\ttargetVectorsGQL, ok := targetsGql[\"targetVectors\"]\n\t\tif !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\"targetVectors is required field, got %v\", targets)\n\t\t}\n\t\ttargetVectorsArray, ok := targetVectorsGQL.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\"targetVectors is not an array, got %v\", targetVectorsGQL)\n\t\t}\n\t\ttargetVectors := make([]string, len(targetVectorsArray))\n\t\tfor i, value := range targetVectorsArray {\n\t\t\ttargetVectors[i], ok = value.(string)\n\t\t\tif !ok {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"target vector is not a string, got %v\", value)\n\t\t\t}\n\t\t}\n\n\t\tcombinationType, ok := targetsGql[\"combinationMethod\"]\n\t\ttargetCombinationType := dto.DefaultTargetCombinationType\n\t\tif ok {\n\t\t\ttargetCombinationType, ok = combinationType.(dto.TargetCombinationType)\n\t\t\tif !ok {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"combinationMethod is not a TargetCombinationType, got %v\", combinationType)\n\t\t\t}\n\t\t}\n\n\t\tweightsGQL, ok := targetsGql[\"weights\"]\n\t\tvar weightsIn map[string]interface{}\n\t\tif ok {\n\t\t\tweightsIn = weightsGQL.(map[string]interface{})\n\t\t}\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/graphql/local/common_filters/extract_targets.go#L21-L57","documentation":"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.","triggerScenarios":"targetVectors containing non-string entries, e.g. [1, 2], [null], or [[\"title_vector\"]] from over-nesting in client query variables.","commonSituations":"Auto-generated query builders that interpolate numeric vector IDs; copy/paste errors nesting the array twice; passing enum values that serialize as numbers.","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)."],"exampleFix":"// before\ntargets: { targetVectors: [[\"title_vector\"]] }\n// after\ntargets: { targetVectors: [\"title_vector\"] }","handlingStrategy":"type-guard","validationCode":"targets.targetVectors.forEach(v => { if (typeof v !== 'string') throw new Error('targetVectors entries must be strings: ' + JSON.stringify(v)); });","typeGuard":"function isNamedVectorList(v) { return Array.isArray(v) && v.length > 0 && v.every(x => typeof x === 'string' && x.length > 0); }","tryCatchPattern":"try { ... } catch (e) { if (String(e).includes('target vector is not a string')) { console.error('Fix targetVectors entries to plain strings'); } throw e; }","preventionTips":["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."],"tags":["graphql","multi-target","type-error"],"backgroundTag":"invalid-argument-value","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}