{"record":{"id":"29cd426e5807a7c1","repo":"JuliusBrussee/caveman","slug":"cave-harness-aborted","errorCode":"cave_harness_aborted","errorMessage":"cave_harness_aborted","messagePattern":"cave_harness_aborted","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/adapters.ts","lineNumber":129,"sourceCode":"    version: identity.adapterVersion,\n    manifest,\n    contractSHA256,\n    async run(request: HarnessRequest): Promise<HarnessResult> {\n      const frozenRequest = snapshotRequest(request);\n      const prepared = prepareLockedHarnessExecution({\n        build: frozenRequest.build,\n        harness: id,\n        adapterVersion: identity.adapterVersion,\n        upstreamVersion: identity.upstreamVersion,\n        contextIR: frozenRequest.contextIR,\n        plan: frozenRequest.plan,\n      });\n      const { build, planSHA256, contextIRSHA256 } = prepared;\n      if (typeof frozenRequest.prompt !== \"string\" || frozenRequest.prompt.length === 0 ||\n          typeof frozenRequest.runID !== \"string\" || frozenRequest.runID.length === 0) {\n        throw new Error(\"cave_harness_request_invalid\");\n      }\n      if (isAborted(frozenRequest.signal)) throw new Error(\"cave_harness_aborted\");\n      validateTransformEvidence(frozenRequest, frozenRequest.plan);\n      const execution = snapshotExecution(await invoke(frozenRequest));\n      if (isAborted(frozenRequest.signal)) throw new Error(\"cave_harness_aborted\");\n      validateExecution(execution, frozenRequest.plan);\n      return {\n        terminal: execution.terminal,\n        text: execution.text,\n        provider: execution.provider,\n        model: execution.model,\n        inputTokens: execution.inputTokens,\n        outputTokens: execution.outputTokens,\n        cacheReadTokens: execution.cacheReadTokens,\n        cacheWriteTokens: execution.cacheWriteTokens,\n        reasoningTokens: execution.reasoningTokens,\n        totalTokens: execution.totalTokens,\n        costUsd: execution.costUsd,\n        usageBasis: execution.usageBasis,\n        priceBasis: execution.priceBasis,","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/adapters.ts#L111-L147","documentation":"When no store is supplied via config, Shrink resolves the recovery-store path (CAVEMAN_CCR_DB, else CAVEMAN_HOME/ccr.db, else ~/.caveman/ccr.db) and opens it with ccr.Open. Any failure to open the SQLite-backed recovery store is wrapped as 'open recovery store %q: %w', preserving the path and underlying error. This is an environment problem (missing dir, permissions, corrupt db, locked db), not an input problem.","triggerScenarios":"Running Shrink with cfg.store == nil and cfg.path == \"\" while ccr.Open(path) fails: unwritable ~/.caveman, a CAVEMAN_CCR_DB pointing to a directory or non-SQLite file, a corrupt ccr.db, or another process holding an exclusive SQLite lock.","commonSituations":"CI containers running as a read-only-root user so ~/.caveman cannot be written; CAVEMAN_CCR_DB set to a path on a full disk; two concurrent shrink processes racing on the same ccr.db; a stale lock file after a crash.","solutions":["Check that the resolved path is a writable location: touch the parent dir as the same user; free disk space.","Verify CAVEMAN_CCR_DB (if set) points to a SQLite file path in an existing directory, not a directory itself.","If the db is corrupt, move the old ccr.db aside and let the tool recreate it (recovery history is lost).","For concurrent runs, serialize shrinks or give each process its own CAVEMAN_CCR_DB."],"exampleFix":"# before\nCAVEMAN_CCR_DB=/var/lib/caveman/ccr.db caveman-shrink < in.json\n# fails if /var/lib/caveman is not writable\n\n# after\nmkdir -p /var/lib/caveman && chown appuser /var/lib/caveman\nCAVEMAN_CCR_DB=/var/lib/caveman/ccr.db caveman-shrink < in.json","handlingStrategy":"try-catch","validationCode":"// Go callers of Shrink: verify the store path is openable first\npath := os.Getenv(\"CAVEMAN_CCR_DB\")\nif path == \"\" {\n    path = filepath.Join(homeDir(), \".caveman\", \"ccr.db\")\n}\nif fi, err := os.Stat(filepath.Dir(path)); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"recovery store dir not ready: %s\", filepath.Dir(path))\n}","typeGuard":null,"tryCatchPattern":"store, closeStore, err := openStore(cfg)\nif err != nil {\n    // env problem: report path + cause, fall back to store-less shrink if the API allows\n    if strings.HasPrefix(err.Error(), \"open recovery store\") {\n        return nil, fmt.Errorf(\"recovery store unavailable (check CAVEMAN_CCR_DB path, permissions, concurrent processes): %w\", err)\n    }\n    return nil, err\n}","preventionTips":["Set CAVEMAN_CCR_DB explicitly in automated environments instead of relying on default home resolution.","Give each concurrent worker its own recovery store to avoid SQLite lock contention.","Monitor free disk space on the volume holding ccr.db."],"tags":["storage","sqlite","environment","filesystem"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}