{"record":{"id":"833801b0a4090612","repo":"can1357/oh-my-pi","slug":"ruby-kernel-unavailable-833801","errorCode":null,"errorMessage":"Ruby kernel unavailable","messagePattern":"Ruby kernel unavailable","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/eval/rb/kernel.ts","lineNumber":152,"sourceCode":"\t\t\t\t\tid: msgId,\n\t\t\t\t\tcode,\n\t\t\t\t\tcwd: opts?.cwd,\n\t\t\t\t\tenv: opts?.env,\n\t\t\t\t\tsilent: opts?.silent ?? false,\n\t\t\t\t\tstoreHistory: opts?.storeHistory ?? !(opts?.silent ?? false),\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tstatic async start(options: KernelStartOptions): Promise<RubyKernel> {\n\t\tconst availability = await logger.time(\n\t\t\t\"RubyKernel.start:availabilityCheck\",\n\t\t\tcheckRubyKernelAvailability,\n\t\t\toptions.cwd,\n\t\t\toptions.interpreter,\n\t\t);\n\t\tif (!availability.ok) {\n\t\t\tthrow new Error(availability.reason ?? \"Ruby kernel unavailable\");\n\t\t}\n\n\t\t// Reuse the interpreter the availability probe selected. The fallback\n\t\t// computes a runtime only for the skip-check fast path (test runtime /\n\t\t// PI_RUBY_SKIP_CHECK), where no candidate was probed.\n\t\tlet runtime = availability.runtime;\n\t\tif (!runtime) {\n\t\t\tconst { env: shellEnv } = (await Settings.init()).getShellConfig();\n\t\t\truntime = options.interpreter\n\t\t\t\t? resolveExplicitRubyRuntime(options.interpreter, options.cwd, filterEnv(shellEnv))\n\t\t\t\t: resolveRubyRuntime(options.cwd, filterEnv(shellEnv));\n\t\t}\n\t\tconst spawnEnv: Record<string, string> = {};\n\t\tfor (const key in runtime.env) {\n\t\t\tconst value = runtime.env[key];\n\t\t\tif (typeof value === \"string\") spawnEnv[key] = value;\n\t\t}\n\t\tfor (const key in options.env) {","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/eval/rb/kernel.ts#L134-L170","documentation":"`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.","triggerScenarios":"Instantiating/starting RubyKernel (start) when the availability check for options.cwd / options.interpreter returns ok:false with no reason string.","commonSituations":"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.","solutions":["Install a supported Ruby interpreter and ensure it is on PATH for the process running the kernel.","Set options.interpreter explicitly to a known-good Ruby binary instead of relying on discovery.","Avoid PI_RUBY_SKIP_CHECK in production; it skips the probe that would surface a broken runtime earlier.","Call checkRubyKernelAvailability directly with your cwd/interpreter to see the concrete probe failure."],"exampleFix":"// before: start with default discovery\nconst kernel = await RubyKernel.start({ cwd: projectDir });\n\n// after: pin the interpreter and check availability first\nconst availability = await checkRubyKernelAvailability(projectDir, \"/usr/bin/ruby\");\nif (!availability.ok) throw new Error(availability.reason ?? \"ruby probe failed\");\nconst kernel = await RubyKernel.start({ cwd: projectDir, interpreter: \"/usr/bin/ruby\" });","handlingStrategy":"validation","validationCode":"const availability = await checkRubyKernelAvailability(options.cwd, options.interpreter);\nif (!availability.ok) {\n  throw new Error(`Cannot start Ruby kernel: ${availability.reason ?? \"probe failed\"}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  kernel = await RubyKernel.start(options);\n} catch (err) {\n  if (err instanceof Error && err.message === \"Ruby kernel unavailable\") {\n    return { ok: false, hint: \"install Ruby or set options.interpreter\" };\n  }\n  throw err;\n}","preventionTips":["Never enable PI_RUBY_SKIP_CHECK outside tests.","Bake Ruby + kernel deps into the container image and verify in CI.","Start the kernel eagerly at session start so a missing runtime surfaces early, not mid-task."],"tags":["ruby","kernel","startup","missing-interpreter"],"backgroundTag":"runtime-not-available","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}