JuliusBrussee/caveman · error
eval evidence file contains no records
Error message
eval evidence file contains no records
What it means
After parsing, the CLI requires at least one evidence record before contacting the server. If the file contained only blank lines or whitespace (no non-empty lines survived), it throws this error rather than POSTing an empty batch.
Solutions
- Check the file has content (`wc -l evidence.jsonl`, `cat evidence.jsonl`) and regenerate the export if empty.
- Fix the upstream filter/query that produced no matching eval records, then re-export.
- Skip the import step in CI when the export is empty instead of invoking the command.
Example fix
// before (shell) jq -c 'select(.run == "missing-run")' all.jsonl > evidence.jsonl caveman audit eval-import evidence.jsonl # empty file -> contains no records // after (shell) jq -c 'select(.run == "run-2026-09")' all.jsonl > evidence.jsonl [ -s evidence.jsonl ] && caveman audit eval-import evidence.jsonl
Defensive patterns
Strategy: validation
Validate before calling
// shell
[ -s evidence.jsonl ] && grep -qve '^\s*$' evidence.jsonl || { echo "evidence file empty; skipping import"; exit 0; } Prevention
- Guard imports with a non-empty file check (`-s`).
- Verify the upstream export actually produced records.
- Make CI import steps conditional on file content.
When it happens
Trigger: Running `caveman audit eval-import <file>` where the file is empty or contains only whitespace/blank lines, so `items.length === 0` after the parse loop.
Common situations: Redirecting output from a command that produced nothing (`> evidence.jsonl` with zero results); a filtered export matching no cases; a CI job exporting before any evals ran.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- eval evidence batch exceeds 1000 records
- eval evidence file exceeds 4 MiB batch limit
- 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/20c7068c29d8a96d.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:17619
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,
}),
});
const body = await response.json();
if (!response.ok) throw new Error(`eval evidence import failed (${response.status}): ${JSON.stringify(body)}`);View on GitHub (pinned to 3ee70a1026)