{"record":{"id":"cbc2cbc0f2171c19","repo":"can1357/oh-my-pi","slug":"conflict-entry-id-target-entry-displaypath","errorCode":null,"errorMessage":"Conflict #${entry.id} target '${entry.displayPath}' no longer exists.","messagePattern":"Conflict #(.+?) target '(.+?)' no longer exists\\.","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/write.ts","lineNumber":854,"sourceCode":"\t * marker region in the registered file with `replacementContent`.\n\t * The write deliberately bypasses the LSP writethrough: the file may\n\t * still hold other unresolved marker blocks, so formatting could\n\t * corrupt them and diagnostics would be marker-noise anyway.\n\t *\n\t * Entry ids are session-stable: they keep working even after later\n\t * writes resolve other blocks in the same file. The recorded range\n\t * is re-validated on disk before splicing so an out-of-band edit\n\t * surfaces as a clear error instead of corrupting the file.\n\t */\n\tasync #resolveConflict(\n\t\tentry: ConflictEntry,\n\t\treplacementContent: string,\n\t\tstripped: boolean,\n\t\tsignal: AbortSignal | undefined,\n\t): Promise<AgentToolResult<WriteToolDetails>> {\n\t\tconst absolutePath = entry.absolutePath;\n\t\tif (!(await fs.exists(absolutePath))) {\n\t\t\tthrow new ToolError(`Conflict #${entry.id} target '${entry.displayPath}' no longer exists.`);\n\t\t}\n\n\t\tconst expanded = expandContentTokens(replacementContent, entry);\n\t\tconst originalText = await Bun.file(absolutePath).text();\n\t\tconst splice = spliceConflict(originalText, entry, expanded);\n\t\tconst newContent = splice.text;\n\n\t\tawait writethroughNoop(absolutePath, newContent, signal);\n\t\tinvalidateFsScanAfterWrite(absolutePath);\n\t\tthis.session.bumpFileMutationVersion?.(absolutePath);\n\t\tthis.session.fileSnapshotStore?.invalidate(absolutePath);\n\t\tconst history = this.session.conflictHistory;\n\t\thistory?.invalidate(entry.id);\n\t\tif (history) {\n\t\t\t// Drop stale duplicate registrations of the same region: a re-read\n\t\t\t// after an out-of-band shift registers a fresh id at the new\n\t\t\t// startLine while the stale twin persists at the old one. A DISTINCT\n\t\t\t// conflict block that is merely byte-identical still occurs in the","sourceCodeStart":836,"sourceCodeEnd":872,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/write.ts#L836-L872","documentation":"When resolving a previously registered read-conflict (a marker block surfaced by `read`), the tool re-checks that the conflict's target file still exists before splicing in the replacement. If the file was deleted (or moved/renamed) between the conflict registration and the resolve attempt, this ToolError aborts the resolution. Conflict entries hold a snapshot id but never resurrect missing files.","triggerScenarios":"Calling write with conflict://<id> (or conflict://* bulk directives) after the target file at entry.absolutePath was deleted or renamed on disk.","commonSituations":"git operations (checkout/rebase) removing or renaming conflicted files, a cleanup step deleting drafts, the agent or user resolving the conflict by rewriting the file manually so the marker path vanished.","solutions":["Re-read the file's directory to see its current state; recreate or restore the file if it should exist.","If the file was intentionally deleted, abandon the conflict — no resolution is needed.","If the file was renamed, re-read the new path so a fresh conflict/marker is registered, then resolve against that.","Run `git status`/VCS inspection to understand what removed the file."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import * as fs from \"node:fs/promises\";\ntry { await fs.access(entry.absolutePath); } catch {\n  throw new Error(`Conflict target ${entry.displayPath} is gone; re-read or abandon`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await write(`conflict://${id}`, replacement);\n} catch (err) {\n  if (String(err.message).includes(\"no longer exists\")) {\n    // file was deleted/renamed — re-read or skip\n  }\n  throw err;\n}","preventionTips":["Resolve conflicts soon after they are registered, before any VCS or cleanup operations run.","Avoid branch switches/rebases while conflicts are pending resolution.","Re-read the file if anything may have modified or moved it since registration."],"tags":["conflict-resolution","file-not-found","stale-state"],"backgroundTag":"stale-conflict-state","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}