can1357/oh-my-pi · error · Error

ONNX Runtime CUDA provider binaries are missing from ${binDi

Error message

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

What it means

When the compiled tiny-model side runtime needs ONNX Runtime CUDA provider binaries (linux x64 with device=cuda/gpu/auto), the installer looks for onnxruntime-node's `script/install.js` inside the side runtime cache. If the CUDA .so files are missing AND the official install script is also absent, there is no way to repair the runtime, so this error is thrown instead of spawning a doomed install.

Source

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

			await fsp.access(path.join(binDir, file));
		} catch {
			missing.push(file);
		}
	}
	return missing;
}

async function readPipe(stream: ReadableStream<Uint8Array> | null): Promise<string> {
	if (!stream) return "";
	return new Response(stream).text();
}

async function installOnnxRuntimeCudaProviders(packageDir: string, runtimeDir: string, binDir: string): Promise<void> {
	const script = path.join(packageDir, "script", "install.js");
	try {
		await fsp.access(script);
	} catch {
		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(

View on GitHub (pinned to 9690622007)

Solutions

  1. Delete the tiny-model side runtime cache directory (the runtimeDir path in the message) so the next run reinstalls it fresh.
  2. Reinstall or repair onnxruntime-node inside the side runtime (npm/bun install onnxruntime-node with postinstall scripts enabled).
  3. Verify the onnxruntime-node package version includes script/install.js; upgrade if the package layout changed.
  4. If CUDA is not actually needed, unset PI_TINY_DEVICE or set it to 'cpu' to skip the CUDA provider path entirely.

Example fix

// before: corrupted side-runtime cache with missing binaries and no installer
// ~/.omp/tiny-runtime/node_modules/onnxruntime-node/  (bin/ and script/ missing)
// after
rm -rf ~/.omp/tiny-runtime   # paths per the error message; next launch reinstalls cleanly
Defensive patterns

Strategy: fallback

Validate before calling

import { access } from "node:fs/promises";
const script = path.join(runtimeDir, "node_modules/onnxruntime-node/script/install.js");
const binDir = path.join(runtimeDir, "node_modules/onnxruntime-node/bin/napi-v6/linux/x64");
let repairable = false;
try { await access(script); repairable = true; } catch {}
if (!repairable) console.warn("side runtime unrepairable; wipe cache before proceeding");

Try / catch

try {
  await ensureOnnxRuntimeCudaProviders(runtimeDir, device);
} catch (err) {
  if (String(err.message).includes("is unavailable")) {
    await fs.rm(runtimeDir, { recursive: true, force: true });
    await ensureOnnxRuntimeCudaProviders(runtimeDir, device);
  } else throw err;
}

Prevention

When it happens

Trigger: Calls to ensureOnnxRuntimeCudaProviders (via loadTransformersRuntime) where missingOnnxRuntimeCudaProviderFiles(binDir) returns files and fsp.access(packageDir/script/install.js) fails — i.e. a partially-pruned or corrupted onnxruntime-node package in runtimeDir/node_modules.

Common situations: The side-runtime cache was copied incompletely (rsync/copy that skipped script/), a post-install cleanup stripped the install.js, or a package manager prune removed postinstall scripts from onnxruntime-node in the extracted compiled runtime.

Related errors


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