{"record":{"id":"9aeb56ee059f0614","repo":"JuliusBrussee/caveman","slug":"cave-build-lock-missing-approve-required-evals-t","errorCode":null,"errorMessage":"cave_build_lock_missing: approve required evals, then run npm run build","messagePattern":"cave_build_lock_missing: approve required evals, then run npm run build","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/cli.ts","lineNumber":939,"sourceCode":"\nfunction configuredModelCandidates(baseline: string): string[] {\n  const models = new Set<string>([baseline]);\n  if (process.env.ANTHROPIC_API_KEY) models.add(\"anthropic/claude-haiku-4-5\");\n  if (process.env.OPENAI_API_KEY) models.add(\"openai/gpt-5.4-mini\");\n  if (process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY) models.add(\"google/gemini-2.5-flash\");\n  return [...models].sort();\n}\n\nasync function check(args: string[]): Promise<void> {\n  const root = process.cwd();\n  const configPath = args[0] ?? \"caveman.config.ts\";\n  const loaded = await loadBuildInputs(root, configPath);\n  let lock: CaveBuildLock;\n  try {\n    lock = await readLock(root);\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n      throw new Error(\"cave_build_lock_missing: approve required evals, then run npm run build\");\n    }\n    throw error;\n  }\n  const transformRegistrySha256 = await transformRegistrySHA256();\n  const checked = checkLock(lock, {\n    sourceSha256: loaded.sourceSha256,\n    agentDefinitionSha256: agentDefinitionSHA256(loaded.agent),\n    contextIRSha256: contextIRSHA256(await lowerBuildContext(\n      root,\n      loaded.agent,\n    ).then((value) => value.ir)),\n    evalSuiteSha256: sha256(stableStringify(loaded.evals.filter((item) => item.approved && item.required))),\n    runtimeVersion: FRAMEWORK_VERSION,\n    adapterVersion: PI_ADAPTER_VERSION,\n    upstreamVersion: PI_UPSTREAM_VERSION,\n    transformRegistrySha256,\n    catalogSha256: CATALOG_SHA256,\n  });","sourceCodeStart":921,"sourceCodeEnd":957,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/cli.ts#L921-L957","documentation":"Thrown by the `check` command when `readLock(root)` fails with ENOENT — i.e. `.caveman/agent.lock.json` does not exist in the project root. The lock file is the immutable record of the last successful build; `check` verifies current sources against it and cannot run without it. The message directs you to approve the required eval fixtures and run the build first.","triggerScenarios":"Running `caveman check` (or `npm run check`) in a fresh clone, after `git clean`, after deleting `.caveman/`, or in a worktree where the build artifact was never generated. Also when the working directory is not the project root the config was built from.","commonSituations":"Fresh clone / CI checkout without the build step; `.caveman/` gitignored and a colleague runs check before build; switching branches that removed the lock; running the CLI from a subdirectory so `resolve(root, ...)` misses the file.","solutions":["Approve the required eval fixtures (the build writes `needs_eval` and stops when none are approved), then run `npm run build` to generate `.caveman/agent.lock.json`.","Verify you are in the project root that contains `caveman.config.ts` and `.caveman/`.","In CI, order the pipeline build-before-check or restore the lock artifact from cache."],"exampleFix":"# before\nnpm run check   # Error: cave_build_lock_missing\n\n# after\nnpm run build    # after approving required evals\nnpm run check","handlingStrategy":"try-catch","validationCode":"import { access } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\n\nasync function lockExists(root: string): Promise<boolean> {\n  try { await access(resolve(root, \".caveman/agent.lock.json\")); return true; }\n  catch { return false; }\n}\n// if (!await lockExists(root)) run build first","typeGuard":null,"tryCatchPattern":"try {\n  await check(args);\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith(\"cave_build_lock_missing\")) {\n    // approve required evals, then run the build command, then re-check\n  } else throw error;\n}","preventionTips":["Make `check` always depend on `build` in scripts and CI (npm-run order or pipeline stages).","Commit or cache `.caveman/agent.lock.json` so fresh checkouts can verify.","Run CLI commands from the project root."],"tags":["build","lock","cli","workflow"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}