{"record":{"id":"1c366d63b175c9c1","repo":"earendil-works/pi","slug":"first-kept-entry-has-no-uuid-session-may-need-mi","errorCode":null,"errorMessage":"First kept entry has no UUID - session may need migration","messagePattern":"First kept entry has no UUID - session may need migration","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/core/compaction/compaction.ts","lineNumber":940,"sourceCode":"\t\t\tcustomInstructions,\n\t\t\tpreviousSummary,\n\t\t\tthinkingLevel,\n\t\t\tstreamFn,\n\t\t\tenv,\n\t\t\tretry,\n\t\t\tcallbacks,\n\t\t\tsessionId,\n\t\t);\n\t\tsummary = result.text;\n\t\tsummaryUsage = result.usage;\n\t}\n\n\t// Compute file lists and append to summary\n\tconst { readFiles, modifiedFiles } = computeFileLists(fileOps);\n\tsummary += formatFileOperations(readFiles, modifiedFiles);\n\n\tif (!firstKeptEntryId) {\n\t\tthrow new Error(\"First kept entry has no UUID - session may need migration\");\n\t}\n\n\treturn {\n\t\tsummary,\n\t\tfirstKeptEntryId,\n\t\ttokensBefore,\n\t\tusage: summaryUsage,\n\t\tdetails: { readFiles, modifiedFiles } as CompactionDetails,\n\t};\n}\n\n/**\n * Generate a summary for a turn prefix (when splitting a turn).\n */\nasync function generateTurnPrefixSummary(\n\tmessages: AgentMessage[],\n\tmodel: Model<any>,\n\treserveTokens: number,","sourceCodeStart":922,"sourceCodeEnd":958,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/core/compaction/compaction.ts#L922-L958","documentation":"Data-integrity failure in compaction: the entry chosen as the first kept entry after summarization has no UUID, so the compaction entry cannot reference a stable point in the transcript. Usually indicates an old session file predating UUID-based entries.","triggerScenarios":"Thrown at packages/coding-agent/src/core/compaction/compaction.ts:940 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Migrate or re-save the session so entries carry UUIDs","Start a new session if migration is not available","Report a bug with the session file for migration support"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}