can1357/oh-my-pi · error · Error

Failed to install ONNX Runtime CUDA provider binaries into $

Error message

Failed to install ONNX Runtime CUDA provider binaries into ${binDir} with ${process.execPath} ${script} (exit ${exitCode}). Remove the tiny-model side runtime cache at ${runtimeDir} and retry with network access. ${output}

What it means

The ONNX Runtime CUDA provider install script (onnxruntime-node's script/install.js) was found and spawned with process.execPath, but exited non-zero. The error includes the script's captured stdout/stderr so the underlying download/extraction failure is visible, and advises clearing the side-runtime cache and retrying with network access.

Source

Thrown at packages/coding-agent/src/subprocess/worker-runtime.ts:224

		throw new Error(
			`ONNX Runtime CUDA provider binaries are missing from ${binDir}, and ${script} is unavailable. Remove the tiny-model side runtime cache at ${runtimeDir} and retry.`,
		);
	}

	const proc = Bun.spawn([process.execPath, script], {
		cwd: runtimeDir,
		env: { ...Bun.env, BUN_BE_BUN: "1", ONNXRUNTIME_NODE_INSTALL: ONNX_RUNTIME_CUDA_INSTALL },
		stdout: "pipe",
		stderr: "pipe",
	});
	const [stdout, stderr, exitCode] = await Promise.all([
		readPipe(proc.stdout as ReadableStream<Uint8Array> | null),
		readPipe(proc.stderr as ReadableStream<Uint8Array> | null),
		proc.exited,
	]);
	if (exitCode !== 0) {
		const output = `${stdout}\n${stderr}`.trim();
		throw new Error(
			`Failed to install ONNX Runtime CUDA provider binaries into ${binDir} with ${process.execPath} ${script} (exit ${exitCode}). Remove the tiny-model side runtime cache at ${runtimeDir} and retry with network access. ${output}`,
		);
	}
}

/**
 * Repairs the compiled Transformers side runtime when CUDA was requested and
 * Bun skipped `onnxruntime-node`'s NuGet sidecar install.
 */
export async function ensureOnnxRuntimeCudaProviders(
	runtimeDir: string,
	device = process.env.PI_TINY_DEVICE,
): Promise<void> {
	if (!shouldInstallOnnxRuntimeCudaProviders(device)) return;
	const nodeModules = path.join(runtimeDir, "node_modules");
	const manifest = resolveRuntimeModule(nodeModules, `${ONNX_RUNTIME_NODE_PACKAGE}/package.json`);
	if (!manifest)
		throw new Error(`Unable to resolve ${ONNX_RUNTIME_NODE_PACKAGE} in compiled runtime at ${nodeModules}`);

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the ${output} tail of the message to find the root cause (DNS, 403, disk space, etc.) and fix that.
  2. Restore network access / configure proxy env vars (HTTPS_PROXY) so the script can download the CUDA provider packages.
  3. Remove the tiny-model side runtime cache at runtimeDir and retry.
  4. Free disk space if extraction failed; verify CUDA-compatible linux x64 platform.
  5. Set PI_TINY_DEVICE=cpu to skip CUDA provider installation if GPU acceleration is not required.
Defensive patterns

Strategy: retry

Validate before calling

// preflight connectivity to the package host before attempting install
const res = await fetch("https://www.nuget.org/api/v2/", { method: "HEAD" }).catch(() => null);
if (!res?.ok) console.warn("no network; CUDA provider install will likely fail");

Try / catch

try {
  await ensureOnnxRuntimeCudaProviders(runtimeDir, "cuda");
} catch (err) {
  if (String(err.message).includes("(exit")) {
    logger.warn("CUDA provider install failed", { output: err.message });
    // fall back to CPU device instead of failing the worker
  } else throw err;
}

Prevention

When it happens

Trigger: ensureOnnxRuntimeCudaProviders detects missing CUDA binaries in binDir and calls installOnnxRuntimeCudaProviders; the spawned install script (ONNXRUNTIME_NODE_INSTALL=cuda) exits with code != 0 — typically a failed NuGet/package download.

Common situations: Offline or firewalled machines that cannot reach onnxruntime's CDN/NuGet feed, proxy/TLS interception breaking the download, disk-full during extraction, or an unsupported linux x64 CUDA configuration rejected by the script.

Related errors


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