{"record":{"id":"43cdd61cf8008be0","repo":"earendil-works/pi","slug":"not-found","errorCode":"not_found","errorMessage":"Session not found: ${metadata.id}","messagePattern":"Session not found: (.+?)","errorType":"error_code","errorClass":"SessionError","httpStatus":null,"severity":"error","filePath":"packages/agent/src/harness/session/jsonl/repo.ts","lineNumber":94,"sourceCode":"\t\t\tconst [firstLine] = fileResult(\n\t\t\t\tawait options.fs.readTextLines(file.path, { maxLines: 1 }),\n\t\t\t\t`Failed to read session header ${file.path}`,\n\t\t\t);\n\t\t\tif (!firstLine) continue;\n\t\t\tconst headerResult = parseHeader(firstLine);\n\t\t\tif (!headerResult.ok) continue;\n\t\t\tmetadata.push(metadataFromHeader(headerResult.value, file.path, file.mtimeMs));\n\t\t}\n\t}\n\treturn metadata.sort((left, right) => right.modifiedAt - left.modifiedAt);\n}\n\nexport async function loadJsonlSessionStorage(\n\toptions: JsonlSessionRepoOptions,\n\tmetadata: JsonlSessionMetadata,\n): Promise<JsonlSessionStorage> {\n\tif (!fileResult(await options.fs.exists(metadata.path), `Failed to check session ${metadata.path}`)) {\n\t\tthrow new SessionError(\"not_found\", `Session not found: ${metadata.id}`);\n\t}\n\tconst storage = await JsonlSessionStorage.load(options.fs, metadata.path);\n\tconst loadedMetadata = await storage.getMetadata();\n\tif (loadedMetadata.id !== metadata.id) {\n\t\tthrow new SessionError(\"invalid_entry\", `Session id does not match header: ${metadata.id}`);\n\t}\n\treturn storage;\n}\n\nfunction sessionFileName(createdAt: number, id: string): string {\n\tconst timestamp = new Date(createdAt).toISOString().replace(/[:.]/g, \"-\");\n\treturn `${timestamp}_${id}.jsonl`;\n}\n\nexport class JsonlSessionRepo\n\timplements SessionRepo<JsonlSessionMetadata, JsonlSessionCreateOptions, JsonlSessionListOptions>\n{\n\tprivate readonly fs: JsonlSessionRepoFileSystem;","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/agent/src/harness/session/jsonl/repo.ts#L76-L112","documentation":"Error \"Session not found: ${metadata.id}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/agent/src/harness/session/jsonl/repo.ts:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the session id and that the session file exists in the sessions directory; create or restore the session first."],"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"}