{"record":{"id":"941b11dc8a40e2c4","repo":"can1357/oh-my-pi","slug":"pr-listing-failed-message","errorCode":null,"errorMessage":"pr:// listing failed: ${message}","messagePattern":"pr:// listing failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/internal-urls/issue-pr-protocol.ts","lineNumber":575,"sourceCode":"\n/**\n * Handler for `pr://` URLs.\n */\nexport class PrProtocolHandler implements ProtocolHandler {\n\treadonly scheme = \"pr\";\n\treadonly immutable = true;\n\n\tasync resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource> {\n\t\tif (context?.signal?.aborted) {\n\t\t\tthrow new Error(\"aborted\");\n\t\t}\n\t\tconst parsed = parseUrl(url, \"pr\");\n\t\tif (parsed.kind === \"list\") {\n\t\t\ttry {\n\t\t\t\treturn await fetchAndRenderList(\"pr\", parsed, url, context);\n\t\t\t} catch (err) {\n\t\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\t\tthrow new Error(`pr:// listing failed: ${message}`);\n\t\t\t}\n\t\t}\n\t\tif (parsed.kind === \"pr-diff\") {\n\t\t\ttry {\n\t\t\t\treturn await fetchAndRenderPrDiff(url, parsed, context);\n\t\t\t} catch (err) {\n\t\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\t\tthrow new Error(`pr:// diff resolution failed: ${message}`);\n\t\t\t}\n\t\t}\n\t\tconst cwd = resolveCwd(context);\n\t\tlet repo = parsed.repo;\n\t\tif (!repo) {\n\t\t\ttry {\n\t\t\t\trepo = await resolveDefaultRepoMemoized(cwd, context?.signal);\n\t\t\t} catch (err) {\n\t\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\t\tthrow new Error(","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/internal-urls/issue-pr-protocol.ts#L557-L593","documentation":"Wrapper error thrown by PrProtocolHandler.resolve (packages/coding-agent/src/internal-urls/issue-pr-protocol.ts:575) when fetchAndRenderList — the pr://owner/repo listing path (open PR list) — fails. The original message is preserved after the `pr:// listing failed:` prefix, mirroring the issue:// listing wrapper.","triggerScenarios":"Resolving a pr:// listing URL when the underlying list fetch fails: gh CLI missing/unauthenticated, network failure, invalid or private repo slug, or unresolvable default repo for a repo-less pr:// listing URL.","commonSituations":"gh not installed or logged out; GitHub rate limit; typo'd owner/repo; offline; using pr://<n> style repo-less forms outside a git checkout with no GitHub remote.","solutions":["Inspect the inner message after the `pr:// listing failed: ` prefix for the root cause.","Authenticate: `gh auth status`; `gh auth login` if needed.","Use the explicit pr://owner/repo listing form rather than relying on default-repo detection.","Check connectivity and API rate limits; retry after backoff if rate-limited.","Confirm the session cwd is the intended repository when default-repo resolution is in play."],"exampleFix":"// before\nconst res = await prHandler.resolve(parse(\"pr://acme/widgets\"));\n// after\ntry {\n  const res = await prHandler.resolve(parse(\"pr://acme/widgets\"));\n} catch (err) {\n  const cause = String(err.message).replace(\"pr:// listing failed: \", \"\");\n  console.error(`Cannot list PRs: ${cause}`);\n}","handlingStrategy":"try-catch","validationCode":"const gh = $which(\"gh\");\nif (!gh) throw new Error(\"gh CLI not installed\");\nconst auth = await $`gh auth status`.quiet().nothrow();\nif (auth.exitCode !== 0) throw new Error(\"gh not authenticated\");\nif (!/^pr:\\/\\/[^/]+\\/[^/]+/.test(url.href)) throw new Error(\"use pr://owner/repo form\");","typeGuard":"function isPrListFailure(err: unknown): err is Error {\n  return err instanceof Error && err.message.startsWith(\"pr:// listing failed: \");\n}","tryCatchPattern":"try {\n  return await prHandler.resolve(url, ctx);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"pr:// listing failed: \")) {\n    const cause = err.message.slice(\"pr:// listing failed: \".length);\n    logger.warn(\"pr listing failed\", { cause });\n    return null;\n  }\n  throw err;\n}","preventionTips":["Ensure gh is installed and authenticated before using pr:// URLs.","Use explicit pr://owner/repo listing URLs instead of repo-less forms.","Watch GitHub API rate limits; add backoff in automated loops.","Verify owner/repo spelling before constructing URLs."],"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"}