{"record":{"id":"1959fba2ba562c67","repo":"n8n-io/n8n","slug":"filter-operator-operator-on-key-key-requ-1959fb","errorCode":null,"errorMessage":"Filter operator \"${operator}\" on key \"${key}\" requires a non-empty array value.","messagePattern":"Filter operator \"(.+?)\" on key \"(.+?)\" requires a non-empty array value\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/agents/src/vector-stores/qdrant.ts","lineNumber":170,"sourceCode":"function buildCondition(condition: FilterCondition): Schemas['Condition'] {\n\tconst { key, operator, value } = condition;\n\tconst payloadKey = `metadata.${key}`;\n\n\tswitch (operator) {\n\t\tcase 'eq':\n\t\tcase 'ne': {\n\t\t\tif (typeof value === 'number' && !Number.isInteger(value)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Filter operator \"${operator}\" on key \"${key}\" does not support float values: Qdrant match only supports strings, integers, and booleans.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst match: Schemas['Condition'] = { key: payloadKey, match: { value } };\n\t\t\treturn operator === 'eq' ? match : { must_not: [match] };\n\t\t}\n\t\tcase 'in':\n\t\tcase 'nin': {\n\t\t\tif (!Array.isArray(value) || value.length === 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Filter operator \"${operator}\" on key \"${key}\" requires a non-empty array value.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst allStrings = value.every((v) => typeof v === 'string');\n\t\t\tconst allIntegers = value.every((v) => typeof v === 'number' && Number.isInteger(v));\n\t\t\tif (!allStrings && !allIntegers) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Filter operator \"${operator}\" on key \"${key}\" requires all array elements to be strings or all to be integers: Qdrant match does not support mixed-type or float values.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// eslint-disable-next-line id-denylist -- `any` is Qdrant's match-schema field name\n\t\t\tconst anyCondition: Schemas['Condition'] = { key: payloadKey, match: { any: value } };\n\t\t\treturn operator === 'in' ? anyCondition : { must_not: [anyCondition] };\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(`Unsupported filter operator: \"${String(operator)}\"`);\n\t}\n}","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/agents/src/vector-stores/qdrant.ts#L152-L188","documentation":"Thrown by buildCondition in the Qdrant backend when an `in`/`nin` condition's value is not an array or is an empty array. Mirrors the same guard on Pinecone/Postgres/Supabase: an empty `in`/`nin` is meaningless. Operator and key are named in the message. This is the array-shape guard; element-type rules are enforced separately by error 116.","triggerScenarios":"`{ key: 'tag', operator: 'in', value: [] }`; passing a scalar to an `in` condition; a candidate list emptied by upstream logic.","commonSituations":"A multi-select UI cleared by the user but the filter still sent; default empty array; set operations removing all candidates.","solutions":["Omit the `in`/`nin` condition when the array is empty.","Guard condition construction with a length check.","Drop the whole filter if no conditions remain."],"exampleFix":"// before\nawait store.search('q', {\n  filter: { conditions: [{ key: 'tag', operator: 'in', value: [] }] },\n});\n\n// after\nconst conditions = [];\nif (tags.length > 0) conditions.push({ key: 'tag', operator: 'in', value: tags });\nawait store.search('q',\n  conditions.length ? { filter: { conditions, combineWith: 'and' } } : undefined,\n);","handlingStrategy":"validation","validationCode":"function dropEmptyInConditions(filter: VectorFilter): VectorFilter | undefined {\n  const conditions = filter.conditions.filter(\n    (c) => !(c.operator === 'in' || c.operator === 'nin') || (Array.isArray(c.value) && c.value.length > 0),\n  );\n  return conditions.length > 0 ? { ...filter, conditions } : undefined;\n}\n\nconst f = dropEmptyInConditions(inputFilter);\nawait store.search('q', f ? { filter: f } : undefined);","typeGuard":"function isInCondition(c: FilterCondition): c is FilterCondition & { operator: 'in' | 'nin'; value: (string | number)[] } {\n  return (c.operator === 'in' || c.operator === 'nin') && Array.isArray(c.value) && c.value.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Push an `in`/`nin` condition only when the array is non-empty.","Treat a cleared multi-select as 'no filter', not 'empty in'.","Drop empty-array in/nin conditions centrally so each backend is protected."],"tags":["qdrant","filter","validation","vector-store"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}