{"record":{"id":"324171e30c5079e7","repo":"can1357/oh-my-pi","slug":"conflict-id-not-found-conflict-ids-are-regist","errorCode":null,"errorMessage":"Conflict #${id} not found. Conflict ids are registered when \\`read\\` surfaces a marker block; re-read the file to get a current id.","messagePattern":"Conflict #(.+?) not found\\. Conflict ids are registered when \\\\`read\\\\` surfaces a marker block; re-read the file to get a current id\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/read.ts","lineNumber":1912,"sourceCode":"\t\tif (truncationInfo) {\n\t\t\tresultBuilder.truncation(truncationInfo.result, truncationInfo.options);\n\t\t}\n\t\tif (columnTruncated > 0) {\n\t\t\tresultBuilder.limits({ columnMax: columnTruncated });\n\t\t}\n\t\treturn resultBuilder.done();\n\t}\n\n\t/**\n\t * Render a `conflict://<N>` (or `conflict://<N>/<scope>`) region as\n\t * regular file content. The lines are emitted with their original\n\t * file line numbers so hashline anchors line up with the source\n\t * file, and no truncation footer is appended.\n\t */\n\tasync #readConflictRegion(id: number, scope: ConflictScope | undefined): Promise<AgentToolResult<ReadToolDetails>> {\n\t\tconst entry: ConflictEntry | undefined = getConflictHistory(this.session).get(id);\n\t\tif (!entry) {\n\t\t\tthrow new ToolError(\n\t\t\t\t`Conflict #${id} not found. Conflict ids are registered when \\`read\\` surfaces a marker block; re-read the file to get a current id.`,\n\t\t\t);\n\t\t}\n\n\t\tconst region = renderConflictRegion(entry, scope);\n\t\tconst displayMode = resolveFileDisplayMode(this.session);\n\t\tconst shouldAddHashLines = displayMode.hashLines;\n\t\tconst shouldAddLineNumbers = shouldAddHashLines ? false : displayMode.lineNumbers;\n\n\t\tconst rawText = region.lines.join(\"\\n\");\n\t\tconst tag = shouldAddHashLines ? await recordFileSnapshot(this.session, entry.absolutePath) : undefined;\n\t\tconst hashContext = tag\n\t\t\t? hashlineHeaderContext(formatPathRelativeToCwd(entry.absolutePath, this.session.cwd), tag)\n\t\t\t: undefined;\n\t\tconst formattedBody = formatTextWithMode(rawText, region.startLine, shouldAddHashLines, shouldAddLineNumbers);\n\t\tconst formattedText = prependHashlineHeader(formattedBody, hashContext);\n\n\t\tconst details: ReadToolDetails = {","sourceCodeStart":1894,"sourceCodeEnd":1930,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/read.ts#L1894-L1930","documentation":"Conflict-marker regions get numeric ids registered in session conflict history only when a prior read surfaced the marker block. Reading a conflict region with an id that is absent (stale session, wrong id, or never-registered) throws this error and instructs re-reading the file.","triggerScenarios":"Calling the conflict-region read path (read with a conflict id qualifier) with an id not present in getConflictHistory(session): id from a previous session, id already cleared after resolution, or an invented id.","commonSituations":"Session restarted after resolving some conflicts; agent cached conflict ids from an earlier read; merge-conflict markers re-generated so history was reset.","solutions":["Re-read the file containing conflict markers so current ids are registered, then use the returned id.","Check you are in the same session where the conflict was originally surfaced.","If the conflict was already resolved, read the file normally instead of via the conflict-region API."],"exampleFix":"// before\nreadConflict(id=7)  // from previous session\n// after\nconst res = await read(\"file.txt\"); // surfaces marker block, registers id\nreadConflict(id=res.conflictId)","handlingStrategy":"try-catch","validationCode":"const ids = getConflictHistory(session); if (!ids.has(id)) { await read(conflictFile); /* refresh ids */ }","typeGuard":"function conflictExists(session, id) { return getConflictHistory(session).has(id); }","tryCatchPattern":"try { return await readConflict(id) } catch (e) { if (String(e.message).includes('not found') && e.message.includes('Conflict')) { await read(file); /* get fresh id from result, retry once */ } else throw e; }","preventionTips":["Always obtain conflict ids from a read in the current session","Never persist conflict ids across sessions or after resolutions","Re-read the file when a conflict id lookup fails"],"tags":["read-tool","conflict-markers","stale-state"],"backgroundTag":"stale-resource-id","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}