{"record":{"id":"7f43aa1000e4f53f","repo":"can1357/oh-my-pi","slug":"nested-repo-patch-for-relativepath-did-not-incl","errorCode":null,"errorMessage":"Nested repo patch for ${relativePath} did not include stageable file paths.","messagePattern":"Nested repo patch for (.+?) did not include stageable file paths\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/task/worktree.ts","lineNumber":386,"sourceCode":"\t\t\tcontinue;\n\t\t}\n\t\tconst repository = vcs.requireGit(nestedDir);\n\n\t\tconst combinedDiff = repoPatches.map(p => p.patch).join(\"\\n\");\n\t\tconst touchedFiles = [...new Set(repoPatches.flatMap(p => patchTouchedFiles(p.patch)))];\n\n\t\t// Preserve any pre-existing dirty state (tracked + untracked) so we\n\t\t// commit only the agent delta, not the user's in-flight work.\n\t\tconst stashed = (await repository.isDirty())\n\t\t\t? await repository.stashPush(`omp-isolation-${Snowflake.next()}`)\n\t\t\t: false;\n\t\ttry {\n\t\t\tfor (const { patch } of repoPatches) {\n\t\t\t\tawait repository.applyPatch(patch, {});\n\t\t\t}\n\t\t\tif (await repository.isDirty()) {\n\t\t\t\tif (touchedFiles.length === 0) {\n\t\t\t\t\tthrow new Error(`Nested repo patch for ${relativePath} did not include stageable file paths.`);\n\t\t\t\t}\n\t\t\t\tconst msg = (await commitMessage?.(combinedDiff)) ?? \"changes from isolated task(s)\";\n\t\t\t\tawait repository.stageFiles(touchedFiles);\n\t\t\t\tawait repository.commitCreate(msg, {});\n\t\t\t}\n\t\t} finally {\n\t\t\tif (stashed) {\n\t\t\t\tconst restored = await repository.stashTryPop(true).catch(() => false);\n\t\t\t\tif (!restored) {\n\t\t\t\t\tlogger.warn(\"Pre-existing nested-repo dirty state could not be auto-restored\", {\n\t\t\t\t\t\tnestedDir,\n\t\t\t\t\t});\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\t`Pre-existing dirty state in nested repo \\`${relativePath}\\` could not be auto-restored after the agent commit; stash entry preserved.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/task/worktree.ts#L368-L404","documentation":"When committing combined diffs from isolated tasks back into a nested repository, applyNestedPatches tracks which files were touched so it can stage them. If the patch produced a dirty worktree but touchedFiles is empty, there is nothing stageable to build the commit from, so it throws rather than silently losing changes.","triggerScenarios":"Calling applyNestedPatches where `repository.isDirty()` returns true after applying a nested repo's patches, but the parsed touchedFiles list for that relative path is empty (patch parsing yielded no file paths).","commonSituations":"Patches containing only binary or oddly-formed diffs whose file paths could not be extracted; changes already present in the nested repo's worktree making it dirty before the patch applied; malformed patch headers.","solutions":["Inspect the nested repo's `git status` — pre-existing uncommitted changes may be making it dirty; commit or stash them first","Regenerate the task patch ensuring standard `diff --git a/... b/...` headers with valid file paths","If the changes are actually there, commit them manually in the nested repo"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before applying: ensure the nested repo is clean so dirty-state implies our patch\nif (await repository.isDirty()) {\n\tthrow new Error(`Nested repo ${relativePath} has uncommitted changes; commit or stash first`);\n}","typeGuard":null,"tryCatchPattern":"try {\n\tawait applyNestedPatches(patches);\n} catch (err) {\n\tif ((err as Error).message.includes(\"did not include stageable file paths\")) {\n\t\tlogger.error(\"Patch parse produced no file paths; committing manually\", { relativePath });\n\t}\n\tthrow err;\n}","preventionTips":["Generate patches with standard `git diff` (a/ b/ prefixes) so paths parse","Commit or stash pre-existing changes in nested repos before task merge","Log the patch head when parsing to verify file paths were extracted"],"tags":["git","patch","nested-repository"],"backgroundTag":"patch-no-stageable-paths","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}