can1357/oh-my-pi · error · Error

Proxy configuration uses a scheme Bun's fetch cannot use${de

Error message

Proxy configuration uses a scheme Bun's fetch cannot use${detail}. Only http:// and https:// proxies are supported — SOCKS proxies (socks5://, socks5h://) are not. Point HTTP_PROXY/HTTPS_PROXY at an http:// proxy URL or unset the proxy variables, then retry.

What it means

Bun's fetch only supports HTTP(S) proxies via HTTP_PROXY/HTTPS_PROXY. When the release-metadata request fails and isUnsupportedProxyError detects the proxy URL uses an unsupported scheme (e.g. socks5://, socks5h://), the error is rewrapped with this actionable message explaining the limitation and the fix.

Source

Thrown at packages/coding-agent/src/cli/update-cli.ts:268

): Promise<ReleaseBinaryAsset> {
	const tag = `v${expectedVersion}`;
	const headers: Record<string, string> = {
		Accept: "application/vnd.github+json",
		"X-GitHub-Api-Version": "2022-11-28",
	};
	if (githubToken) headers.Authorization = `Bearer ${githubToken}`;

	let response: Response;
	try {
		response = await fetchImpl(`${GITHUB_API}/repos/${REPO}/releases/tags/${encodeURIComponent(tag)}`, {
			headers,
			signal: withTimeoutSignal(RELEASE_METADATA_TIMEOUT_MS),
		});
	} catch (err) {
		if (isTimeoutError(err)) {
			throw new Error("Timed out fetching GitHub release metadata after 30s", { cause: err });
		}
		if (isUnsupportedProxyError(err)) throw new Error(unsupportedProxyMessage(), { cause: err });
		throw err;
	}
	if ((response.status === 403 && !githubToken) || response.status === 429) {
		throw new Error(
			"GitHub API rate limit exceeded while fetching release metadata; retry later or set GITHUB_TOKEN or GH_TOKEN",
		);
	}
	if (!response.ok) {
		throw new Error(`Failed to fetch GitHub release metadata: ${response.statusText}`);
	}

	return resolveReleaseBinaryAsset(await response.json(), tag, binaryName, { allowPrerelease });
}

export interface VerifiedBinaryDownloadOptions {
	url: string;
	targetPath: string;
	expectedSize: number;

View on GitHub (pinned to 9690622007)

Solutions

  1. Point HTTP_PROXY/HTTPS_PROXY at an HTTP proxy URL, e.g. export HTTPS_PROXY=http://127.0.0.1:1080 (most SOCKS clients expose a mixed/http port).
  2. Unset the proxy variables for this run: env -u HTTP_PROXY -u HTTPS_PROXY omp update.
  3. Use a tool like privoxy/gost to bridge SOCKS to an HTTP proxy and point the env vars at it.
  4. Run the update on a network that reaches api.github.com directly.

Example fix

// before
export HTTPS_PROXY=socks5://127.0.0.1:1080
// after
export HTTPS_PROXY=http://127.0.0.1:7890
Defensive patterns

Strategy: validation

Validate before calling

const proxy = process.env.HTTPS_PROXY ?? process.env.https_proxy ?? process.env.HTTP_PROXY ?? process.env.http_proxy;
if (proxy && !/^https?:\/\//i.test(proxy)) {
  console.error(`Proxy ${proxy} uses a scheme Bun fetch cannot use; set an http:// proxy or unset the variable.`);
  process.exit(1);
}

Type guard

function isSupportedProxy(proxy: string): boolean {
  try { return ["http:", "https:"].includes(new URL(proxy).protocol); } catch { return false; }
}

Try / catch

try {
  await update();
} catch (err) {
  if (err instanceof Error && err.message.includes("scheme Bun's fetch cannot use")) {
    console.error("Switch HTTP_PROXY/HTTPS_PROXY to an http:// proxy URL (or unset them) and retry.");
  } else throw err;
}

Prevention

When it happens

Trigger: getReleaseBinaryAsset's fetch throws, isUnsupportedProxyError(err) is true — i.e. HTTP_PROXY/HTTPS_PROXY/ALL_PROXY is set to a SOCKS (or other non-http/https) scheme and Bun's fetch rejects it.

Common situations: Corporate or personal environments routing traffic through a local SOCKS proxy (SSH -D tunnels, Clash, v2ray, Tor) with `export HTTPS_PROXY=socks5://127.0.0.1:1080`, then running `omp update`.

Related errors


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