can1357/oh-my-pi · error · Error

Ruby kernel unavailable

Error message

Ruby kernel unavailable

What it means

Before executing Ruby eval code, `ensureKernelAvailable` runs `checkRubyKernelAvailability(cwd, options.interpreter)` to probe for a usable Ruby kernel/runtime. If the probe returns not-ok and carries no specific reason, this generic fallback error is thrown. It means the executor could not find or validate a Ruby environment capable of hosting the kernel.

Source

Thrown at packages/coding-agent/src/eval/rb/executor.ts:189

		code,
		options,
		runIdPrefix: "rb",
		errorLogLabel: "Ruby",
		cancelledErrorClass: RubyExecutionCancelledError,
		buildKernelEnvPatch: buildManagedKernelEnvPatch,
		formatKernelTimeoutAnnotation,
		formatTimeoutAnnotation,
	});
}

async function ensureKernelAvailable(cwd: string, options: RubyExecutorOptions): Promise<void> {
	const availability = await waitForPromiseWithCancellation(
		checkRubyKernelAvailability(cwd, options.interpreter),
		options,
		RubyExecutionCancelledError,
	);
	if (!availability.ok) {
		throw new Error(availability.reason ?? "Ruby kernel unavailable");
	}
}

async function ensureToolBridge(options: RubyExecutorOptions): Promise<void> {
	if (!options.toolSession || options.bridge) return;
	try {
		options.bridge = await ensurePyToolBridge();
	} catch (err) {
		logger.warn("Failed to start Ruby tool bridge", {
			error: err instanceof Error ? err.message : String(err),
		});
	}
}

const sessionRegistry = createKernelSessionRegistry<
	RubyKernel,
	RubyExecutorOptions,
	RubyResult,

View on GitHub (pinned to 9690622007)

Solutions

  1. Verify a working Ruby is available: run `ruby -v` in the target cwd and install Ruby if missing.
  2. Check/correct the `interpreter` option passed to the executor — point it at a valid Ruby binary.
  3. Install the Ruby kernel dependencies the availability probe expects (kernel gem/bundle) for the selected interpreter.
  4. If the error message lacks a reason, run the availability check directly (checkRubyKernelAvailability) to get the underlying probe failure.

Example fix

// before: no interpreter resolved in the executor options
const result = await executeRuby(code, { cwd: "/work" });

// after: pin a verified interpreter
const result = await executeRuby(code, {
  cwd: "/work",
  interpreter: "/usr/bin/ruby", // verified via `ruby -v`
});
Defensive patterns

Strategy: validation

Validate before calling

const { checkRubyKernelAvailability } = await import("./eval/rb/kernel");
const availability = await checkRubyKernelAvailability(cwd, interpreter);
if (!availability.ok) {
  throw new Error(`Ruby environment not usable: ${availability.reason ?? "no reason provided"}`);
}

Try / catch

try {
  await ensureKernelAvailable(options);
} catch (err) {
  if (err instanceof Error && err.message === "Ruby kernel unavailable") {
    // fall back to another executor or surface an install-Ruby hint
    return fallbackExecutor ?? null;
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling the Ruby executor (executeRuby → ensureKernelAvailable) when checkRubyKernelAvailability fails — no usable Ruby interpreter found at/below the given interpreter path, or the availability probe errored with an empty reason.

Common situations: Ruby is not installed or not on PATH; a custom `options.interpreter` points to a missing/wrong binary; the required kernel gem/bundle is absent; environment restrictions (PATH, sandbox, container) hide the interpreter.

Related errors


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