JuliusBrussee/caveman · error
eval evidence batch exceeds 1000 records
Error message
eval evidence batch exceeds 1000 records
What it means
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`.
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.
Example fix
// before (shell) caveman audit eval-import ./evidence.jsonl # 3500 records -> exceeds 1000 // after (shell) split -l 1000 evidence.jsonl part_ for f in part_*; do caveman audit eval-import "$f" --project 1234-abcd; done
Defensive patterns
Strategy: validation
Validate before calling
// shell lines=$(grep -cve '^\s*$' evidence.jsonl) if [ "$lines" -gt 1000 ]; then split -l 1000 evidence.jsonl part_; fi
Prevention
- Count non-empty lines before import and chunk at 1000.
- Automate splitting in CI pipelines.
- Export eval runs in bounded slices from the start.
When it happens
Trigger: Running `caveman audit eval-import` on a file whose non-empty lines yield more than 1000 valid JSON object records.
Common situations: 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.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- eval evidence file exceeds 4 MiB batch limit
- eval evidence file contains no records
- eval evidence line is not valid JSON
- eval evidence line must be a JSON object
- usage: eval-import <evidence.jsonl> [--project ] [--dry-run]
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/11700db8e68fe79d.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:17617
if (!file) throw new Error(`usage: ${invokedCommand("audit")} eval-import <evidence.jsonl> [--project <uuid>] [--dry-run]`);
const data = await readFile(file);
if (data.byteLength > 4 * 1024 * 1024) throw new Error("eval evidence file exceeds 4 MiB batch limit");
const items: Record<string, unknown>[] = [];
for (const [index, rawLine] of data.toString("utf8").split(/\r?\n/).entries()) {
const line = rawLine.trim();
if (!line) continue;
let parsed: unknown;
try {
parsed = JSON.parse(line);
} catch {
throw new Error(`eval evidence line ${index + 1} is not valid JSON`);
}
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
throw new Error(`eval evidence line ${index + 1} must be a JSON object`);
}
items.push(parsed as Record<string, unknown>);
if (items.length > 1000) throw new Error("eval evidence batch exceeds 1000 records");
}
if (items.length === 0) throw new Error("eval evidence file contains no records");
const cfg = await config();
const project = flagFrom(argv, "--project", cfg.projectId ?? "");
const response = await fetch(`${cfg.baseURL}/api/v1/eval-evidence/batches`, {
method: "POST",
headers: {
authorization: `Bearer ${cfg.token}`,
"content-type": "application/json",
"x-cave-csrf": "cli",
},
body: JSON.stringify({
...(project ? { project_id: project } : {}),
dry_run: argv.includes("--dry-run"),
items,
}),
});View on GitHub (pinned to 3ee70a1026)