JuliusBrussee/caveman · error
usage: eval-import <evidence.jsonl> [--project ] [--dry-run]
Error message
usage: ${invokedCommand("audit")} eval-import <evidence.jsonl> [--project <uuid>] [--dry-run] What it means
`auditEvalImport` imports newline-delimited eval evidence and, like audit import, requires the evidence file as a positional argument. When `positionalAfterOptions` finds no file argument, the CLI throws this usage error showing the accepted syntax.
Solutions
- Supply the evidence file as a positional argument: `caveman audit eval-import ./evidence.jsonl --project <uuid>`.
- Keep the file path as the first argument, before any --project or --dry-run flags.
- Quote paths containing spaces and verify the file exists with `ls`.
Example fix
// before (shell) caveman audit eval-import --project 1234-abcd --dry-run // error: usage: caveman audit eval-import <evidence.jsonl> ... // after (shell) caveman audit eval-import ./evidence.jsonl --project 1234-abcd --dry-run
Defensive patterns
Strategy: validation
Validate before calling
// shell
file_arg=$(echo "$args" | awk '{print $1}')
[ -f "$file_arg" ] || { echo "usage: caveman audit eval-import <evidence.jsonl> [--project <uuid>] [--dry-run]"; exit 1; } Prevention
- Place the evidence file first, before --project/--dry-run flags.
- Verify the file exists with `ls`/`test -f` before invoking.
- Use --dry-run to validate argument wiring cheaply.
When it happens
Trigger: Running `caveman audit eval-import` with only options (e.g. `--project <uuid> --dry-run`) and no evidence file path, or with the file placed before options so the parser misses it.
Common situations: Omitting the .jsonl path in CI pipeline configuration; assuming --project is the first argument; typo in the file path causing the parser to treat it as an unknown option.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- usage: import --format
- eval evidence batch exceeds 1000 records
- eval evidence file contains no records
- eval evidence file exceeds 4 MiB batch limit
- eval evidence line is not valid JSON
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/2285a31008d68407.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:17599
"content-type": "application/octet-stream",
"x-cave-csrf": "cli"
};
const fieldMap = flagFrom(argv, "--field-map", "");
if (fieldMap) headers["x-cave-field-map"] = fieldMap;
const response = await fetch(`${cfg.baseURL}/api/v1/imports?format=${encodeURIComponent(format)}`, {
method: "POST",
headers,
body: data
});
print(await response.json());
}
// auditEvalImport turns newline-delimited, source-neutral eval records into one
// bounded batch. Server stamps tenant scope, observed basis, and external-only
// authority; CI cannot promote its own results into rollout authority.
async function auditEvalImport(argv: string[]) {
const file = positionalAfterOptions(argv.slice(1), new Set(["--project"]));
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");View on GitHub (pinned to 3ee70a1026)