can1357/oh-my-pi · error · Error
Nested repo patch for ${relativePath} did not include stagea
Error message
Nested repo patch for ${relativePath} did not include stageable file paths. What it means
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.
Source
Thrown at packages/coding-agent/src/task/worktree.ts:386
continue;
}
const repository = vcs.requireGit(nestedDir);
const combinedDiff = repoPatches.map(p => p.patch).join("\n");
const touchedFiles = [...new Set(repoPatches.flatMap(p => patchTouchedFiles(p.patch)))];
// Preserve any pre-existing dirty state (tracked + untracked) so we
// commit only the agent delta, not the user's in-flight work.
const stashed = (await repository.isDirty())
? await repository.stashPush(`omp-isolation-${Snowflake.next()}`)
: false;
try {
for (const { patch } of repoPatches) {
await repository.applyPatch(patch, {});
}
if (await repository.isDirty()) {
if (touchedFiles.length === 0) {
throw new Error(`Nested repo patch for ${relativePath} did not include stageable file paths.`);
}
const msg = (await commitMessage?.(combinedDiff)) ?? "changes from isolated task(s)";
await repository.stageFiles(touchedFiles);
await repository.commitCreate(msg, {});
}
} finally {
if (stashed) {
const restored = await repository.stashTryPop(true).catch(() => false);
if (!restored) {
logger.warn("Pre-existing nested-repo dirty state could not be auto-restored", {
nestedDir,
});
warnings.push(
`Pre-existing dirty state in nested repo \`${relativePath}\` could not be auto-restored after the agent commit; stash entry preserved.`,
);
}
}
}View on GitHub (pinned to 9690622007)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// before applying: ensure the nested repo is clean so dirty-state implies our patch
if (await repository.isDirty()) {
throw new Error(`Nested repo ${relativePath} has uncommitted changes; commit or stash first`);
} Try / catch
try {
await applyNestedPatches(patches);
} catch (err) {
if ((err as Error).message.includes("did not include stageable file paths")) {
logger.error("Patch parse produced no file paths; committing manually", { relativePath });
}
throw err;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- patch does not apply: {message}
- not a repository: {path}
- reference not found: {name}
- object not found: {spec}
- cherry-pick of {sha} is empty
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/7f43aa1000e4f53f.
Report an issue: GitHub.