{"record":{"id":"2daf7a2bea6b27c9","repo":"can1357/oh-my-pi","slug":"resulttext","errorCode":null,"errorMessage":"resultText","messagePattern":"resultText","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/write.ts","lineNumber":1095,"sourceCode":"\t\t\t);\n\t\t\tfor (const file of failedFiles) {\n\t\t\t\tsummaryLines.push(`  ${file.displayPath}: ${file.count} ${conflictWord(file.count)} (${file.error})`);\n\t\t\t}\n\t\t}\n\t\tconst headerLines = succeededFiles\n\t\t\t.map(file => file.header)\n\t\t\t.filter((header): header is string => header !== undefined);\n\t\tif (headerLines.length > 0) {\n\t\t\tsummaryLines.push(\"Snapshots:\");\n\t\t\tfor (const header of headerLines) summaryLines.push(`  ${header}`);\n\t\t}\n\t\tif (stripped && !directives) {\n\t\t\tsummaryLines.push(\"Note: auto-stripped hashline display prefixes from content before writing.\");\n\t\t}\n\t\tconst resultText = summaryLines.join(\"\\n\");\n\n\t\tif (failedFiles.length > 0 && succeededFiles.length === 0) {\n\t\t\tthrow new ToolError(resultText);\n\t\t}\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text: resultText }],\n\t\t\tdetails: {},\n\t\t\tisError: failedFiles.length > 0 ? true : undefined,\n\t\t};\n\t}\n\n\tasync execute(\n\t\t_toolCallId: string,\n\t\t{ path: rawPath, content }: WriteParams,\n\t\tsignal?: AbortSignal,\n\t\tonUpdate?: AgentToolUpdateCallback<WriteToolDetails>,\n\t\tcontext?: AgentToolContext,\n\t): Promise<AgentToolResult<WriteToolDetails>> {\n\t\t// Strip a hashline `[path#TAG]` wrapper up front so every downstream\n\t\t// decision (scheme routing, internal-URL handler dispatch, plan-mode\n\t\t// guard, plan path resolution, ACP bridge routing) sees the same","sourceCodeStart":1077,"sourceCodeEnd":1113,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/write.ts#L1077-L1113","documentation":"In bulk conflict resolution, per-file results are summarized into `resultText`. If every attempted file failed (failedFiles > 0 and succeededFiles === 0), the whole operation is considered failed and the summary text itself is thrown as the ToolError message — the bracketed label 'resultText' is just the logging name for that thrown summary. If some files succeeded, the result is returned normally with isError marked instead.","triggerScenarios":"A conflict://* bulk resolve (with or without directives) where every selected file's resolution attempt failed — e.g. all target files missing, all splices failing to match, or every write rejected.","commonSituations":"Bulk resolve after a branch switch removed all conflicted files; directive content that fails expansion for every entry; permission problems affecting all target paths at once.","solutions":["Read the multi-line summary in the error to see each file's specific failure and fix those individually.","Re-read the files to refresh conflict entries, then retry.","Resolve conflicts one at a time (conflict://<id>) to isolate the failing file.","Check whether the target files still exist and contain the expected markers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"for (const entry of selected) {\n  if (!(await Bun.file(entry.absolutePath).exists())) {\n    throw new Error(`#${entry.id} target missing — bulk resolve would fail entirely`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await write(\"conflict://*\", directives);\n} catch (err) {\n  // err.message is a per-file summary; parse lines and resolve surviving conflicts individually\n  for (const line of String(err.message).split(\"\\n\")) handleSummaryLine(line);\n}","preventionTips":["Pre-resolve conflicts one at a time to avoid all-or-nothing bulk failures.","Verify every target file exists before bulk resolution.","Inspect the multi-line summary in the error for each file's root cause."],"tags":["conflict-resolution","bulk-resolve","partial-failure"],"backgroundTag":"bulk-operation-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}