{"record":{"id":"bb076f83dfc2d7ce","repo":"earendil-works/pi","slug":"agent-run-failed-and-cleanup-also-failed","errorCode":null,"errorMessage":"Agent run failed and cleanup also failed.","messagePattern":"Agent run failed and cleanup also failed\\.","errorType":"exception","errorClass":"AggregateError","httpStatus":null,"severity":"error","filePath":"packages/evals/src/pi-harness.ts","lineNumber":236,"sourceCode":"\t\t\t}\n\t\t} catch (error) {\n\t\t\tcleanupErrors.push(error);\n\t\t}\n\t}\n\ttry {\n\t\tsession?.dispose();\n\t} catch (error) {\n\t\tcleanupErrors.push(error);\n\t}\n\ttry {\n\t\tawait rm(root, { recursive: true, force: true });\n\t} catch (error) {\n\t\tcleanupErrors.push(error);\n\t}\n\n\tif (!outcome.success) {\n\t\tif (cleanupErrors.length === 0) throw outcome.error;\n\t\tthrow new AggregateError([outcome.error, ...cleanupErrors], \"Agent run failed and cleanup also failed.\");\n\t}\n\tif (cleanupErrors.length === 1) throw cleanupErrors[0];\n\tif (cleanupErrors.length > 1) throw new AggregateError(cleanupErrors, \"Agent cleanup failed.\");\n\treturn {\n\t\t...outcome.result,\n\t\ttimings: { totalMs: performance.now() - startedAt },\n\t};\n}\n\nexport function createPiCodingAgentHarness<TOutput extends JsonValue>(\n\toptions: PiCodingAgentHarnessWithOutput<TOutput>,\n): Harness<PiCodingAgentInput, TOutput>;\nexport function createPiCodingAgentHarness(options?: PiCodingAgentHarnessOptions): Harness<PiCodingAgentInput, string>;\nexport function createPiCodingAgentHarness<TOutput extends JsonValue>(\n\toptions: PiCodingAgentHarnessOptions | PiCodingAgentHarnessWithOutput<TOutput> = {},\n) {\n\treturn createHarness<PiCodingAgentInput, string | TOutput>({\n\t\tname: options.name ?? \"pi-coding-agent\",","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/evals/src/pi-harness.ts#L218-L254","documentation":"Error \"Agent run failed and cleanup also failed.\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/evals/src/pi-harness.ts:236 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}