can1357/oh-my-pi · error · Error

GitHub API request timed out

Error message

GitHub API request timed out

What it means

getLatestVersion() queries the GitHub releases API to find the latest release tag for a tool's repo. The fetch is wrapped with a combined timeout signal (TOOL_METADATA_TIMEOUT_MS); when the request aborts because that deadline elapsed, the AbortError is translated into this explicit error so callers see a meaningful message instead of a raw DOMException.

Source

Thrown at packages/coding-agent/src/utils/tools-manager.ts:182

	if (fs.existsSync(localPath)) {
		return localPath;
	}

	// Check system PATH
	return $which(config.binaryName);
}

// Fetch latest release version from GitHub
async function getLatestVersion(repo: string, signal?: AbortSignal): Promise<string> {
	let response: Response;
	try {
		response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {
			headers: { "User-Agent": USER_AGENT },
			signal: ptree.combineSignals(signal, TOOL_METADATA_TIMEOUT_MS),
		});
	} catch (err) {
		if (err instanceof Error && err.name === "AbortError") {
			throw new Error("GitHub API request timed out");
		}
		throw err;
	}

	if (!response.ok) {
		throw new Error(`GitHub API error: ${response.status}`);
	}

	const data = (await response.json()) as { tag_name: string };
	return data.tag_name.replace(/^v/, "");
}

/** Download a tool asset without handing the streaming Response to Bun.write. */
export async function downloadFile(url: string, dest: string, signal?: AbortSignal): Promise<void> {
	const downloadSignal = ptree.combineSignals(signal, TOOL_DOWNLOAD_TIMEOUT_MS);
	let response: Response;
	try {
		response = await fetch(url, {

View on GitHub (pinned to 9690622007)

Solutions

  1. Retry the operation once network connectivity is restored — the timeout is per-request, so a simple retry often succeeds.
  2. Check reachability of api.github.com (curl https://api.github.com/rate_limit) to distinguish slowness from a full outage.
  3. Increase TOOL_METADATA_TIMEOUT_MS if you routinely operate on high-latency networks.
  4. Bypass corporate proxy/VPN interference or configure HTTPS_PROXY for the process.
  5. If offline, install the tool manually and rely on the cached installed path instead of the version check.

Example fix

// before: const version = await toolsManager.version("sg") // throws on timeout | // after: wrap in try/catch, on err.message === "GitHub API request timed out" use a cached or pinned fallbackVersion, else rethrow
Defensive patterns

Strategy: retry

Validate before calling

// pre-check connectivity and endpoint latency before calling version() | const probe = await fetch("https://api.github.com/rate_limit", { signal: AbortSignal.timeout(5000) }); if (!probe.ok) throw new Error("GitHub API unreachable; skip version check");

Type guard

function isTimeoutError(err: unknown): err is Error { return err instanceof Error && (err.name === "AbortError" || err.message === "GitHub API request timed out"); }

Try / catch

try { const version = await toolsManager.version("rg"); } catch (err) { if (isTimeoutError(err)) { await Bun.sleep(1000); /* retry with backoff */ } else throw err; }

Prevention

When it happens

Trigger: Calling version/download for a tool when the HTTPS request to https://api.github.com/repos/<repo>/releases/latest does not complete within TOOL_METADATA_TIMEOUT_MS — the fetch is aborted via the combined AbortSignal and rethrown as this error.

Common situations: Slow or flaky network, corporate proxies or VPNs delaying GitHub API responses, GitHub API slowness/outages, or an offline machine with long TCP hangs before failure.

Understand the failure class

Related errors


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