can1357/oh-my-pi · error · ToolError
all ${failures.length} PR checkouts failed: ${failureLines.j
Error message
all ${failures.length} PR checkouts failed:
${failureLines.join("\n")} What it means
executePrCheckout can check out multiple PRs in one call. If every requested PR failed (outcomes empty) and there is more than one failure, it aggregates the per-PR reasons into one ToolError listing each failure line. For a single failure it rethrows the original error instead, so this multi-failure aggregate only appears for batch requests.
Source
Thrown at packages/coding-agent/src/tools/gh-pr-checkout.ts:335
const settled = await Promise.allSettled(
prRefs.map(prRef => checkoutPullRequest(session, signal, { prRef, repo, force })),
);
const outcomes: PrCheckoutOutcome[] = [];
const failures: Array<{ prRef: string | undefined; reason: unknown }> = [];
for (let i = 0; i < settled.length; i++) {
const entry = settled[i];
if (entry.status === "fulfilled") outcomes.push(entry.value);
else failures.push({ prRef: prRefs[i], reason: entry.reason });
}
if (failures.length > 0) {
throwIfAborted(signal);
const failureLines = failures.map(
f => `- ${f.prRef ?? "(current branch)"}: ${f.reason instanceof Error ? f.reason.message : String(f.reason)}`,
);
if (outcomes.length === 0) {
if (failures.length === 1) throw failures[0].reason;
throw new ToolError(`all ${failures.length} PR checkouts failed:\n${failureLines.join("\n")}`);
}
// Partial success: report the worktrees that did get created alongside
// the failures so the agent does not lose track of them.
const sections = outcomes.map(formatPrCheckoutResult);
const header = `# ${outcomes.length}/${settled.length} Pull Request Worktrees checked out (${failures.length} failed)`;
const text = [header, "", ...joinSections(sections), "", "## Failed", ...failureLines].join("\n").trim();
return buildTextResult(text, undefined, {
repo,
checkouts: outcomes.map(outcomeToSummary),
});
}
if (!isMulti) {
const [outcome] = outcomes;
return buildTextResult(formatPrCheckoutResult(outcome), outcome.data.url, {
repo: repo ?? outcome.data.headRepository?.nameWithOwner,
branch: outcome.localBranch,
worktreePath: outcome.worktreePath,View on GitHub (pinned to 9690622007)
Solutions
- Read the per-PR failure lines in the message; fix the specific cause for each (invalid identifier, missing clone URL, etc.) and retry only the failing PRs.
- Retry with a single PR ref to get the underlying error directly instead of the aggregate.
- Verify gh auth (`gh auth status`) and network connectivity if every PR failed with a similar message.
- Drop PRs that no longer exist from the batch; use `gh pr view <N>` to check each one.
Example fix
// before: op pr_checkout 101 102 103 → all failed aggregate // after: diagnose individually gh pr view 101 --json number op pr_checkout 101
Defensive patterns
Strategy: try-catch
Validate before calling
for (const ref of prRefs) {
const ok = await gh.prView(ref).then(v => typeof v.number === "number").catch(() => false);
if (!ok) console.warn(`PR ${ref} unreachable — remove from batch`);
} Try / catch
try {
await op.prCheckout({ prRefs: batch });
} catch (err) {
if (err instanceof ToolError && err.message.startsWith("all ")) {
const perPr = err.message.split("\n").filter(l => l.startsWith("- "));
for (const line of perPr) logFailure(line); // handle each PR individually
} else throw err;
} Prevention
- Pre-check each PR with `gh pr view <N>` before batching.
- Keep batch sizes small so one transient failure doesn't doom everything.
- Verify gh auth/network before large batch runs.
- Drop closed/deleted PRs from batch lists regularly.
When it happens
Trigger: Calling the pr_checkout op with several PR refs where all fail — e.g. all numbers are invalid/deleted PRs, all hit network/auth failures, or a mix of the per-PR errors (2430, 2435-2436) across every requested PR.
Common situations: Batching many PR numbers from an old list where PRs were closed/deleted; GitHub outage hitting all requests; invalid ref strings in every entry of the batch.
Related errors
- Could not determine a clone URL for ${headRepository}.
- invalid PR identifier: ${prRef}. Pass a PR number, URL, or b
- GitHub CLI did not return a pull request number.
- local branch ${localBranch} already exists at ${formatShortS
- title is required unless fill is true
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/344e85af6ef57dc6.
Report an issue: GitHub.