can1357/oh-my-pi · error

pr:// listing failed: ${message}

Error message

pr:// listing failed: ${message}

What it means

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.

Source

Thrown at packages/coding-agent/src/internal-urls/issue-pr-protocol.ts:575

/**
 * Handler for `pr://` URLs.
 */
export class PrProtocolHandler implements ProtocolHandler {
	readonly scheme = "pr";
	readonly immutable = true;

	async resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource> {
		if (context?.signal?.aborted) {
			throw new Error("aborted");
		}
		const parsed = parseUrl(url, "pr");
		if (parsed.kind === "list") {
			try {
				return await fetchAndRenderList("pr", parsed, url, context);
			} catch (err) {
				const message = err instanceof Error ? err.message : String(err);
				throw new Error(`pr:// listing failed: ${message}`);
			}
		}
		if (parsed.kind === "pr-diff") {
			try {
				return await fetchAndRenderPrDiff(url, parsed, context);
			} catch (err) {
				const message = err instanceof Error ? err.message : String(err);
				throw new Error(`pr:// diff resolution failed: ${message}`);
			}
		}
		const cwd = resolveCwd(context);
		let repo = parsed.repo;
		if (!repo) {
			try {
				repo = await resolveDefaultRepoMemoized(cwd, context?.signal);
			} catch (err) {
				const message = err instanceof Error ? err.message : String(err);
				throw new Error(

View on GitHub (pinned to 9690622007)

Solutions

  1. Inspect the inner message after the `pr:// listing failed: ` prefix for the root cause.
  2. Authenticate: `gh auth status`; `gh auth login` if needed.
  3. Use the explicit pr://owner/repo listing form rather than relying on default-repo detection.
  4. Check connectivity and API rate limits; retry after backoff if rate-limited.
  5. Confirm the session cwd is the intended repository when default-repo resolution is in play.

Example fix

// before
const res = await prHandler.resolve(parse("pr://acme/widgets"));
// after
try {
  const res = await prHandler.resolve(parse("pr://acme/widgets"));
} catch (err) {
  const cause = String(err.message).replace("pr:// listing failed: ", "");
  console.error(`Cannot list PRs: ${cause}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const gh = $which("gh");
if (!gh) throw new Error("gh CLI not installed");
const auth = await $`gh auth status`.quiet().nothrow();
if (auth.exitCode !== 0) throw new Error("gh not authenticated");
if (!/^pr:\/\/[^/]+\/[^/]+/.test(url.href)) throw new Error("use pr://owner/repo form");

Type guard

function isPrListFailure(err: unknown): err is Error {
  return err instanceof Error && err.message.startsWith("pr:// listing failed: ");
}

Try / catch

try {
  return await prHandler.resolve(url, ctx);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("pr:// listing failed: ")) {
    const cause = err.message.slice("pr:// listing failed: ".length);
    logger.warn("pr listing failed", { cause });
    return null;
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/941b11dc8a40e2c4. Report an issue: GitHub.