{"record":{"id":"66e2d3db659eb028","repo":"JuliusBrussee/caveman","slug":"caveman-build-runner-timeout-must-be-a-positive-i","errorCode":null,"errorMessage":"caveman build: runner timeout must be a positive integer","messagePattern":"caveman build: runner timeout must be a positive integer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/build.ts","lineNumber":438,"sourceCode":"    ...lockWithoutBuild,\n    build_sha256: buildSha256,\n  };\n  return {\n    ...base,\n    status: \"locked\",\n    best_observed_plan_id: selected.candidate.plan.plan_id,\n    baseline_catalog_cost_usd_per_task: baselineCompleted.costPerTask,\n    selected_catalog_cost_usd_per_task: selected.costPerTask,\n    lock,\n  };\n}\n\nasync function withDeadline<T>(\n  invoke: (signal: AbortSignal) => Promise<T>,\n  timeoutMs: number,\n): Promise<T> {\n  if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {\n    throw new Error(\"caveman build: runner timeout must be a positive integer\");\n  }\n  const controller = new AbortController();\n  let timer: NodeJS.Timeout | undefined;\n  const deadline = new Promise<never>((_resolve, reject) => {\n    timer = setTimeout(() => {\n      const error = new Error(\"cave_build_runner_timeout\");\n      controller.abort(error);\n      reject(error);\n    }, timeoutMs);\n  });\n  try {\n    // Abort asks cooperative runners to stop; the independent race prevents an\n    // adapter that ignores AbortSignal from pinning the compiler forever. A late\n    // runner can never mint a lock or known actual cost after this branch returns.\n    return await Promise.race([Promise.resolve().then(() => invoke(controller.signal)), deadline]);\n  } finally {\n    if (timer !== undefined) clearTimeout(timer);\n  }","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/build.ts#L420-L456","documentation":"Error \"caveman build: runner timeout must be a positive integer\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/agent/src/build.ts:438 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the runner timeout to a positive integer (milliseconds)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}