{"record":{"id":"91a4c3cb994fa623","repo":"ruvnet/ruflo","slug":"records-must-be-a-non-empty-array-of-id-vector","errorCode":null,"errorMessage":"records must be a non-empty array of {id?, vector, text?}","messagePattern":"records must be a non-empty array of (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/agenticow-tools.ts","lineNumber":128,"sourceCode":"              id: { type: 'integer', description: 'Explicit id (auto-assigned when omitted)' },\n              vector: { type: 'array', items: { type: 'number' }, description: 'Embedding vector (length must equal the memory dimension)' },\n              text: { type: 'string', description: 'Optional payload surfaced on query hits' },\n            },\n            required: ['vector'],\n          },\n        },\n        dimension: { type: 'integer', description: 'Vector dimension (required only when path does not exist yet)' },\n      },\n      required: ['path', 'records'],\n    },\n    handler: async (input) => {\n      const api = await loadAgenticow();\n      if (!api) return degradedResult('agenticow-not-found');\n\n      const path = resolveMemoryPath(String(input.path));\n      const records = input.records as Array<{ id?: number; vector: number[]; text?: string }>;\n      if (!Array.isArray(records) || records.length === 0) {\n        throw new Error('records must be a non-empty array of {id?, vector, text?}');\n      }\n      for (const r of records) {\n        if (!Array.isArray(r.vector) || r.vector.length === 0) {\n          throw new Error('each record requires a non-empty numeric vector');\n        }\n      }\n      const dim = (input.dimension as number | undefined) ?? records[0].vector.length;\n      const mem = await openWithLineage(api, path, dim);\n      try {\n        const result = await mem.ingest(records.map((r) => ({\n          ...(typeof r.id === 'number' ? { id: r.id } : {}),\n          vector: r.vector,\n          ...(r.text !== undefined ? { text: r.text } : {}),\n        })));\n        await mem.save?.(manifestFor(path));\n        return { success: true, path, ingested: result };\n      } finally {\n        await mem.close?.();","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/mcp-tools/agenticow-tools.ts#L110-L146","documentation":"Thrown by the agenticow_ingest handler (agenticow-tools.ts:128) when the records argument is not a non-empty array of {id?, vector, text?}. Ingestion is the only way to add vectors to an agenticow memory file, and the tool refuses empty batches so a call cannot succeed while silently doing nothing.","triggerScenarios":"Calling agenticow_ingest with records omitted, records: [], or a single record object passed bare instead of wrapped in an array (records: {vector: [...]} instead of records: [{vector: [...]}]).","commonSituations":"A dedupe or threshold filter upstream emptied the batch before ingest; JSON pipelines that unwrap one-element arrays; a first-call seed script whose data load returned nothing.","solutions":["Wrap a single record in an array: records: [{ vector: [0.1, 0.2], text: 'item' }]","Skip the ingest call when your batch logic produced zero records","Log batch size before calling so empty batches are visible in traces"],"exampleFix":"// before\nawait callTool('agenticow_ingest', { path: p, records: [] });\n// throws: records must be a non-empty array of {id?, vector, text?}\n\n// after\nif (batch.length > 0) {\n  await callTool('agenticow_ingest', { path: p, dimension: 384, records: batch });\n}","handlingStrategy":"validation","validationCode":"if (!Array.isArray(records) || records.length === 0) {\n  // nothing to ingest — skip the call instead of erroring\n  return { skipped: true, reason: 'empty batch' };\n}","typeGuard":"const isNonEmptyArray = (v: unknown): v is unknown[] => Array.isArray(v) && v.length > 0;","tryCatchPattern":null,"preventionTips":["Guard ingest calls with a batch-length check so empty batches short-circuit locally","Wrap single records in an array at the call site"],"tags":["validation","agenticow","memory","empty-array","mcp"],"backgroundTag":"empty-array-parameter","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}