{"record":{"id":"11700db8e68fe79d","repo":"JuliusBrussee/caveman","slug":"eval-evidence-batch-exceeds-1000-records","errorCode":null,"errorMessage":"eval evidence batch exceeds 1000 records","messagePattern":"eval evidence batch exceeds 1000 records","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":17617,"sourceCode":"  if (!file) throw new Error(`usage: ${invokedCommand(\"audit\")} eval-import <evidence.jsonl> [--project <uuid>] [--dry-run]`);\n  const data = await readFile(file);\n  if (data.byteLength > 4 * 1024 * 1024) throw new Error(\"eval evidence file exceeds 4 MiB batch limit\");\n\n  const items: Record<string, unknown>[] = [];\n  for (const [index, rawLine] of data.toString(\"utf8\").split(/\\r?\\n/).entries()) {\n    const line = rawLine.trim();\n    if (!line) continue;\n    let parsed: unknown;\n    try {\n      parsed = JSON.parse(line);\n    } catch {\n      throw new Error(`eval evidence line ${index + 1} is not valid JSON`);\n    }\n    if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n      throw new Error(`eval evidence line ${index + 1} must be a JSON object`);\n    }\n    items.push(parsed as Record<string, unknown>);\n    if (items.length > 1000) throw new Error(\"eval evidence batch exceeds 1000 records\");\n  }\n  if (items.length === 0) throw new Error(\"eval evidence file contains no records\");\n\n  const cfg = await config();\n  const project = flagFrom(argv, \"--project\", cfg.projectId ?? \"\");\n  const response = await fetch(`${cfg.baseURL}/api/v1/eval-evidence/batches`, {\n    method: \"POST\",\n    headers: {\n      authorization: `Bearer ${cfg.token}`,\n      \"content-type\": \"application/json\",\n      \"x-cave-csrf\": \"cli\",\n    },\n    body: JSON.stringify({\n      ...(project ? { project_id: project } : {}),\n      dry_run: argv.includes(\"--dry-run\"),\n      items,\n    }),\n  });","sourceCodeStart":17599,"sourceCodeEnd":17635,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L17599-L17635","documentation":"A single eval-import batch may contain at most 1000 records; the CLI counts parsed objects as it appends them and throws as soon as the count exceeds 1000, preventing oversized uploads to `/api/v1/eval-evidence/batches`.","triggerScenarios":"Running `caveman audit eval-import` on a file whose non-empty lines yield more than 1000 valid JSON object records.","commonSituations":"Exporting a large evaluation run as one file; batch-generation scripts writing thousands of cases; forgetting that the limit is per-file/batch, not per-day.","solutions":["Split the evidence into chunks of at most 1000 lines (`split -l 1000 evidence.jsonl part_`) and import each part.","Import files in chronological slices so each stays under the limit.","Automate chunking in CI: `split -l 1000` in a loop before invoking the CLI."],"exampleFix":"// before (shell)\ncaveman audit eval-import ./evidence.jsonl  # 3500 records -> exceeds 1000\n// after (shell)\nsplit -l 1000 evidence.jsonl part_\nfor f in part_*; do caveman audit eval-import \"$f\" --project 1234-abcd; done","handlingStrategy":"validation","validationCode":"// shell\nlines=$(grep -cve '^\\s*$' evidence.jsonl)\nif [ \"$lines\" -gt 1000 ]; then split -l 1000 evidence.jsonl part_; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Count non-empty lines before import and chunk at 1000.","Automate splitting in CI pipelines.","Export eval runs in bounded slices from the start."],"tags":["cli","audit","eval","batch-limit","limits"],"backgroundTag":"value-out-of-range","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}