can1357/oh-my-pi · error · Error

Fetching @oh-my-pi/${pkg}@${version} failed: HTTP ${response

Error message

Fetching @oh-my-pi/${pkg}@${version} failed: HTTP ${response.status}

What it means

refreshCrossNatives downloads the published `@oh-my-pi/pi-natives-linux-<arch>` tarball from the npm registry and throws this error when the HTTP response is not ok (404, 403, 5xx, etc.). It means the registry could not serve the tarball for the requested version.

Source

Thrown at packages/metaharness/src/tb/agent.ts:35

	if (exitCode !== 0) throw new Error(`${command.join(" ")} exited with code ${exitCode}`);
}
/**
 * Refresh cross-target `pi_natives.linux-<arch>*.node` files in
 * `packages/natives/native/` from the published npm leaf package.
 *
 * The binary build embeds whatever `.node` files sit in that directory; on a
 * non-linux host they are stale local cross-builds that can fail `dlopen`
 * inside task guests (undefined libstdc++ symbols). The matching published
 * leaf is the artifact real installs load, so it is the ground truth for
 * embedding; an unpublished working-tree version fails instead of risking
 * loader/API skew.
 */
async function refreshCrossNatives(arches: GuestArch[], version: string): Promise<void> {
	for (const arch of arches) {
		if (process.platform === "linux" && process.arch === arch) continue;
		const pkg = `pi-natives-linux-${arch}`;
		const response = await fetch(`https://registry.npmjs.org/@oh-my-pi/${pkg}/-/${pkg}-${version}.tgz`);
		if (!response.ok) throw new Error(`Fetching @oh-my-pi/${pkg}@${version} failed: HTTP ${response.status}`);
		const archive = new Bun.Archive(await response.arrayBuffer());
		let extracted = 0;
		for (const [entry, file] of await archive.files()) {
			const name = path.posix.basename(entry);
			if (!name.startsWith(`pi_natives.linux-${arch}`) || !name.endsWith(".node")) continue;
			await Bun.write(path.join(NATIVES_DIR, name), file);
			extracted++;
		}
		if (extracted === 0) throw new Error(`@oh-my-pi/${pkg}@${version} tarball contained no .node files`);
	}
}

/** Build and cache self-contained omp binaries for the selected guest architectures. */
export async function prepareAgentBinaries(opts: {
	arches: GuestArch[];
	cacheDir: string;
	rebuild: boolean;
}): Promise<AgentBinaries> {

View on GitHub (pinned to 9690622007)

Solutions

  1. Check the tarball exists: open the registry URL in a browser or `npm view @oh-my-pi/pi-natives-linux-x64 versions`
  2. Publish the missing version of the platform package (or run the publish step) before cross-refresh
  3. Use a version that is actually published on npm
  4. Check network/proxy/VPN and npm registry status if the package is known to exist

Example fix

// before
await prepareAgentBinaries({ arches: ["arm64"], cacheDir, rebuild: true }); // uses unreleased local version
// after — guard against unpublished versions
const { version } = await Bun.file(path.join(CODING_AGENT_DIR, "package.json")).json();
if (version.includes("-") || version === "0.0.0") throw new Error(`version ${version} not published; commit a released version`);
Defensive patterns

Strategy: retry

Validate before calling

async function tarballExists(pkg: string, version: string): Promise<boolean> {
  const res = await fetch(`https://registry.npmjs.org/@oh-my-pi/${pkg}/${version}`);
  return res.ok;
}

Try / catch

try {
  await refreshCrossNatives(arches, version);
} catch (err) {
  if (err instanceof Error && err.message.includes("failed: HTTP 404")) {
    throw new Error(`version ${version} not published to npm; publish or pick a released version`);
  }
  if (err instanceof Error && /failed: HTTP 5\d\d/.test(err.message)) {
    await Bun.sleep(2000); // transient registry error: retry once
    await refreshCrossNatives(arches, version);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling prepareAgentBinaries with guest arches that need cross-native refresh at a `version` for which `https://registry.npmjs.org/@oh-my-pi/pi-natives-linux-<arch>/-/<pkg>-<version>.tgz` returns a non-2xx status — typically 404 because the version was never published for that package.

Common situations: Local/workspace version (e.g. 0.0.0-dev or a snapshot version) that was never published to npm; typo'd or brand-new version published only for some platforms; npm registry outage or proxy blocking; network offline.

Related errors


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