{"record":{"id":"bd54d104be48ebc5","repo":"stablyai/orca","slug":"git-merge-tree-write-tree-is-unavailable-on-this","errorCode":null,"errorMessage":"Git merge-tree --write-tree is unavailable on this execution host.","messagePattern":"Git merge-tree --write-tree is unavailable on this execution host\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/github/conflict-summary.ts","lineNumber":277,"sourceCode":"                if (isUnsupportedMergeTreeWriteTreeError(error)) {\n                  throw error\n                }\n                // Why: `git merge-tree --write-tree` exits 1 for conflicts but still\n                // writes the useful file list; only option rejection reaches fallback.\n                const stdoutFromError = getGitErrorOutput(error, 'stdout')\n                if (stdoutFromError) {\n                  return parseMergeTreeNameOnlyOutput(stdoutFromError)\n                }\n                throw error\n              }\n            },\n            () => loadConflictingFilesWithLegacyMergeTree(repoPath, legacyArgs, localGitOptions),\n            isUnsupportedMergeTreeMergeBaseError\n          ),\n        async () => {\n          // Why: Git before 2.38 cannot derive a reliable real-merge conflict list;\n          // fail closed without respawning the same rejected command every refresh.\n          throw new Error('Git merge-tree --write-tree is unavailable on this execution host.')\n        },\n        isUnsupportedMergeTreeWriteTreeError\n      )\n  )\n}\n\nasync function loadConflictingFilesWithLegacyMergeTree(\n  repoPath: string,\n  legacyArgs: string[],\n  localGitOptions: LocalGitExecOptions\n): Promise<string[]> {\n  try {\n    const result = await gitExecFileAsync(legacyArgs, {\n      cwd: repoPath,\n      ...(localGitOptions.wslDistro ? { wslDistro: localGitOptions.wslDistro } : {})\n    })\n    return parseMergeTreeNameOnlyOutput(result.stdout)\n  } catch (fallbackError) {","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/github/conflict-summary.ts#L259-L295","documentation":"Thrown as the final fallback of the merge-tree capability chain in loadConflictingFiles. The chain first tries `merge-tree --write-tree` (Git 2.38+), then the legacy merge-base form, then this terminal branch. Reaching it means the execution host's git is older than 2.38 AND the legacy form was also rejected (unsupported). Failing closed here is deliberate — the capability cache records the rejection so the same unsupported command is not respawned on every refresh.","triggerScenarios":"SSH host or WSL distro running git < 2.38 where the legacy merge-tree fallback is also rejected; a minimal git build compiled without merge-tree support; a bundled git that was downgraded; the host's git is a wrapper script that rejects merge-tree.","commonSituations":"Older Ubuntu/Debian LTS with git 2.25-2.37; enterprise-managed git that strips subcommands; an SSH appliance with a pinned old git; WSL distro not updated.","solutions":["On the failing host, run `git --version` and `git merge-tree --write-tree 2>&1` to confirm the version gap.","Upgrade git to 2.38 or newer on that host (the project's merge-tree floor).","If upgrade is impossible, conflict-file listing for real merges will remain unavailable on that host — fall back to viewing conflicts via `git status` in a terminal.","Reconnect after upgrading so the capability cache re-probes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { execFileSync } from 'node:child_process'\nfunction gitSupportsWriteTree(gitPath = 'git'): boolean {\n  try {\n    const out = execFileSync(gitPath, ['merge-tree', '--help'], { stdio: ['ignore', 'ignore', 'pipe'] }).toString()\n    return /--write-tree/.test(out)\n  } catch {\n    return false\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const conflicts = await loadConflictingFiles(repoPath, baseOid, localGitOptions)\n} catch (err) {\n  if (/merge-tree --write-tree is unavailable/.test((err as Error).message)) {\n    showLegacyConflictListFallback(repoPath) // instruct user to use `git status`\n    return []\n  }\n  throw err\n}","preventionTips":["Upgrade host git to >= 2.38 (the project's merge-tree floor).","Reconnect after upgrading so the capability cache re-probes rather than staying rejected.","On appliances with pinned git, document that real-merge conflict lists are unavailable."],"tags":["git","merge-tree","version-compat","capability-cache","ssh"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}