{"record":{"id":"5ed882ccbe4b4eb5","repo":"can1357/oh-my-pi","slug":"pr-resolution-failed-message","errorCode":null,"errorMessage":"pr:// resolution failed: ${message}","messagePattern":"pr:// resolution failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/internal-urls/issue-pr-protocol.ts","lineNumber":618,"sourceCode":"\t\t\t\tcwd,\n\t\t\t\trepo,\n\t\t\t\tnumber: parsed.number,\n\t\t\t\tincludeComments: parsed.comments,\n\t\t\t\tsignal: context?.signal,\n\t\t\t\tsettings: settingsFromContext(context),\n\t\t\t});\n\t\t\treturn buildSingleResource({\n\t\t\t\turl,\n\t\t\t\tscheme: \"pr\",\n\t\t\t\tparsed,\n\t\t\t\trendered: lookup.rendered,\n\t\t\t\tstatus: lookup.status,\n\t\t\t\tfetchedAt: lookup.fetchedAt,\n\t\t\t\trepo,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthrow new Error(`pr:// resolution failed: ${message}`);\n\t\t}\n\t}\n}\n","sourceCodeStart":600,"sourceCodeEnd":622,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/internal-urls/issue-pr-protocol.ts#L600-L622","documentation":"Top-level wrapper error for the single-PR path of PrProtocolHandler.resolve (packages/coding-agent/src/internal-urls/issue-pr-protocol.ts:618). When getOrFetchPr fails for a pr://owner/repo/<n> (or pr://<n> after successful repo resolution) URL, the cause's message is preserved after the `pr:// resolution failed: ` prefix. It is the pr:// counterpart of the issue:// resolution wrapper.","triggerScenarios":"Resolving a single pr:// URL when the fetch/render of that PR fails: nonexistent PR number, private repo without gh auth, network error, GitHub rate limit, or stale cache whose live refresh 404s.","commonSituations":"Typo'd PR number or repo slug; PR merged/deleted and not in cache; gh logged out; offline; API secondary rate limiting; private repo not accessible with current credentials.","solutions":["Read the inner message after `pr:// resolution failed: ` for the concrete cause (404, auth, network).","Verify the PR: `gh pr view <n> -R owner/repo` reproduces the fetch independently.","Run `gh auth login` if the cause indicates authentication/permission failure.","Use the explicit pr://owner/repo/<n> form to rule out default-repo detection issues (which throw 1538 instead).","For transient network/rate-limit causes, retry with backoff; cached immutable content may still resolve."],"exampleFix":"// before\nconst res = await prHandler.resolve(parse(\"pr://acme/widgets/99\"));\n// after\ntry {\n  const res = await prHandler.resolve(parse(\"pr://acme/widgets/99\"));\n} catch (err) {\n  const cause = String(err.message).replace(\"pr:// resolution failed: \", \"\");\n  if (/rate limit/i.test(cause)) await Bun.sleep(60_000);\n  else throw err;\n}","handlingStrategy":"try-catch","validationCode":"const check = await $`gh pr view ${n} -R ${owner}/${repo} --json number`.quiet().nothrow();\nif (check.exitCode !== 0) throw new Error(`PR ${n} not accessible in ${owner}/${repo}`);","typeGuard":"function isPrResolutionFailure(err: unknown): err is Error {\n  return err instanceof Error && err.message.startsWith(\"pr:// resolution failed: \");\n}","tryCatchPattern":"try {\n  return await prHandler.resolve(url, ctx);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"pr:// resolution failed: \")) {\n    const cause = err.message.slice(\"pr:// resolution failed: \".length);\n    if (/not found|404/i.test(cause)) return null; // permanently missing\n    if (/rate limit|timeout|network/i.test(cause)) return retryWithBackoff(() => prHandler.resolve(url, ctx));\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Authenticate gh (`gh auth login`) and confirm repo access before resolving pr:// URLs.","Use fully-qualified pr://owner/repo/<n> URLs.","Classify the inner cause to decide retry (network/rate limit) vs permanent failure (404).","Validate the PR number is a positive integer before building the URL.","Refresh stale caches after PRs are force-pushed or the repo migrates."],"tags":["github","network","authentication","error-wrapping","protocol-handler"],"backgroundTag":"github-fetch-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}