{"record":{"id":"67efc2220f7b2134","repo":"JuliusBrussee/caveman","slug":"eval-evidence-line-index-1-must-be-a-json-obj","errorCode":null,"errorMessage":"eval evidence line ${index + 1} must be a JSON object","messagePattern":"eval evidence line (.+?) must be a JSON object","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":17614,"sourceCode":"// authority; CI cannot promote its own results into rollout authority.\nasync function auditEvalImport(argv: string[]) {\n  const file = positionalAfterOptions(argv.slice(1), new Set([\"--project\"]));\n  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\"),","sourceCodeStart":17596,"sourceCodeEnd":17632,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L17596-L17632","documentation":"Beyond being parseable JSON, every evidence line must be a JSON object (a record). Lines that parse to strings, numbers, booleans, null, or arrays are rejected with the 1-based line number, since the batch API expects object records.","triggerScenarios":"Running `caveman audit eval-import` where a line parses but is not a plain object — e.g. a bare `\"ok\"` string, a number, a JSON array of records on one line, or a `null` line.","commonSituations":"Exporting an array to a single line instead of one object per line; logging plain values/strings between records; a generator emitting `null` placeholders for skipped cases.","solutions":["Rewrite the offending line as a single JSON object record (one object per line).","If you have an array, split it: `jq -c '.[]' array.json > evidence.jsonl` then re-import.","Filter out non-object lines: `jq -c 'select(type == \"object\")' evidence.jsonl > fixed.jsonl`."],"exampleFix":"// before (evidence.jsonl)\n[{\"case\":\"t1\",\"score\":1.0}]\n// error: eval evidence line 1 must be a JSON object\n// after\njq -c '.[]' evidence.jsonl > fixed.jsonl\n# fixed.jsonl: {\"case\":\"t1\",\"score\":1.0}","handlingStrategy":"validation","validationCode":"// shell\njq -c 'select(type != \"object\")' evidence.jsonl | head  # any output = invalid lines\n# or normalize: jq -c 'select(type == \"object\")' evidence.jsonl > fixed.jsonl","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure one JSON object per line; never dump whole arrays to a single line.","Filter non-object lines with jq before import.","Fix the exporter to always emit object records."],"tags":["cli","json","audit","eval","validation"],"backgroundTag":"schema-validation-failed","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"}