can1357/oh-my-pi · error · Error

Ruby kernel unavailable

Error message

Ruby kernel unavailable

What it means

`RubyKernel.start` re-validates the Ruby environment with `checkRubyKernelAvailability` before booting the kernel and throws this fallback error if the probe fails without a specific reason. Unlike the executor path, this fires during explicit kernel startup (which may run in-process via the named availability check), so any Ruby code evaluation cannot proceed.

Source

Thrown at packages/coding-agent/src/eval/rb/kernel.ts:152

					id: msgId,
					code,
					cwd: opts?.cwd,
					env: opts?.env,
					silent: opts?.silent ?? false,
					storeHistory: opts?.storeHistory ?? !(opts?.silent ?? false),
				}),
		});
	}

	static async start(options: KernelStartOptions): Promise<RubyKernel> {
		const availability = await logger.time(
			"RubyKernel.start:availabilityCheck",
			checkRubyKernelAvailability,
			options.cwd,
			options.interpreter,
		);
		if (!availability.ok) {
			throw new Error(availability.reason ?? "Ruby kernel unavailable");
		}

		// Reuse the interpreter the availability probe selected. The fallback
		// computes a runtime only for the skip-check fast path (test runtime /
		// PI_RUBY_SKIP_CHECK), where no candidate was probed.
		let runtime = availability.runtime;
		if (!runtime) {
			const { env: shellEnv } = (await Settings.init()).getShellConfig();
			runtime = options.interpreter
				? resolveExplicitRubyRuntime(options.interpreter, options.cwd, filterEnv(shellEnv))
				: resolveRubyRuntime(options.cwd, filterEnv(shellEnv));
		}
		const spawnEnv: Record<string, string> = {};
		for (const key in runtime.env) {
			const value = runtime.env[key];
			if (typeof value === "string") spawnEnv[key] = value;
		}
		for (const key in options.env) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Install a supported Ruby interpreter and ensure it is on PATH for the process running the kernel.
  2. Set options.interpreter explicitly to a known-good Ruby binary instead of relying on discovery.
  3. Avoid PI_RUBY_SKIP_CHECK in production; it skips the probe that would surface a broken runtime earlier.
  4. Call checkRubyKernelAvailability directly with your cwd/interpreter to see the concrete probe failure.

Example fix

// before: start with default discovery
const kernel = await RubyKernel.start({ cwd: projectDir });

// after: pin the interpreter and check availability first
const availability = await checkRubyKernelAvailability(projectDir, "/usr/bin/ruby");
if (!availability.ok) throw new Error(availability.reason ?? "ruby probe failed");
const kernel = await RubyKernel.start({ cwd: projectDir, interpreter: "/usr/bin/ruby" });
Defensive patterns

Strategy: validation

Validate before calling

const availability = await checkRubyKernelAvailability(options.cwd, options.interpreter);
if (!availability.ok) {
  throw new Error(`Cannot start Ruby kernel: ${availability.reason ?? "probe failed"}`);
}

Try / catch

try {
  kernel = await RubyKernel.start(options);
} catch (err) {
  if (err instanceof Error && err.message === "Ruby kernel unavailable") {
    return { ok: false, hint: "install Ruby or set options.interpreter" };
  }
  throw err;
}

Prevention

When it happens

Trigger: Instantiating/starting RubyKernel (start) when the availability check for options.cwd / options.interpreter returns ok:false with no reason string.

Common situations: First use of the Ruby eval feature on a machine without Ruby; PI_RUBY_SKIP_CHECK fast path previously masked a broken runtime; a version change or container image without Ruby; PATH differs between shell and the host process.

Related errors


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