{"record":{"id":"13fd0cb31c740f4a","repo":"can1357/oh-my-pi","slug":"availability-reason-julia-kernel-unavailable-13fd0c","errorCode":null,"errorMessage":"${availability.reason ?? \"Julia kernel unavailable\"}","messagePattern":"\\$\\{availability\\.reason \\?\\? \"Julia kernel unavailable\"\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/eval/jl/kernel.ts","lineNumber":149,"sourceCode":"\t\t\t\t\t\tif (val !== undefined) {\n\t\t\t\t\t\t\tconst k_b64 = Buffer.from(key).toString(\"base64\");\n\t\t\t\t\t\t\tconst v_b64 = Buffer.from(val).toString(\"base64\");\n\t\t\t\t\t\t\tenvPairs.push(`${k_b64}:${v_b64}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst envPairsStr = envPairs.join(\" \");\n\t\t\t\tconst codeB64 = Buffer.from(code).toString(\"base64\");\n\n\t\t\t\treturn `run\\t${msgId}\\t${cwdB64}\\t${silentVal}\\t${storeHistVal}\\t${envPairsStr}\\t${codeB64}`;\n\t\t\t},\n\t\t});\n\t}\n\n\tstatic async start(options: KernelStartOptions): Promise<JuliaKernel> {\n\t\tconst availability = await checkJuliaKernelAvailability(options.cwd, options.interpreter);\n\t\tif (!availability.ok) {\n\t\t\tthrow new Error(availability.reason ?? \"Julia kernel unavailable\");\n\t\t}\n\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? resolveExplicitJuliaRuntime(options.interpreter, options.cwd, filterEnv(shellEnv))\n\t\t\t\t: resolveJuliaRuntime(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) {\n\t\t\tconst value = options.env[key];\n\t\t\tif (typeof value === \"string\") spawnEnv[key] = value;\n\t\t}","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/eval/jl/kernel.ts#L131-L167","documentation":"`JuliaKernel.start` boots a new kernel subprocess and first re-checks availability with `checkJuliaKernelAvailability`, throwing this plain Error (probe reason or generic fallback) when the probe fails. Unlike the executor path, there is no retry or cancellation wrapper here — the error propagates directly to whoever requested a kernel. Note availability probes for a given cwd+interpreter are cached on success only, so a fresh probe runs each time after a failure.","triggerScenarios":"Direct `JuliaKernel.start({ cwd, interpreter, ... })` when Julia is not on PATH, the explicit interpreter path is wrong, all enumerated runtimes fail the `julia -e 'exit(0)'` probe, or the availability probe was cancelled.","commonSituations":"Embedding/SDK users spawning a kernel directly without Julia installed; pointing `interpreter` at a `juliaia`/`juliaup` shim that doesn't behave as a plain binary; probing from a service account whose PATH lacks user-local julia installs; corrupt Julia installation failing to exit cleanly.","solutions":["Install Julia and ensure the `julia` binary is executable and on PATH for the process spawning the kernel.","Use the thrown reason: \"not found on PATH\" → install/PATH fix; \"Tried: ...\" list shows which binaries failed and why.","Pass `interpreter` as the resolved path to a real `julia` executable (not the juliaup shim) if shims cause probe failures.","Verify manually with `julia -e 'exit(0)'` in the target environment to reproduce and debug the probe.","Retry after installing — failed probes are not cached, so the next start re-probes and picks up a new install."],"exampleFix":"// before\nconst kernel = await JuliaKernel.start({ cwd: projectDir }); // throws: not on PATH\n// after\nconst kernel = await JuliaKernel.start({\n  cwd: projectDir,\n  interpreter: \"/usr/local/bin/julia\",\n});","handlingStrategy":"validation","validationCode":"import { checkJuliaKernelAvailability } from \".../eval/jl/kernel\";\nconst avail = await checkJuliaKernelAvailability(options.cwd, options.interpreter);\nif (!avail.ok) throw new Error(`Cannot start Julia kernel: ${avail.reason}`);\nconst kernel = await JuliaKernel.start(options);","typeGuard":"function canStartKernel(a: { ok: boolean; runtime?: unknown }): a is { ok: true; runtime: NonNullable<typeof a.runtime> } {\n  return a.ok && a.runtime !== undefined;\n}","tryCatchPattern":"let kernel;\ntry {\n  kernel = await JuliaKernel.start({ cwd, interpreter });\n} catch (e) {\n  if (String(e).includes(\"Julia\")) {\n    // probe again after install, or surface install instructions\n    throw new Error(\"Install Julia: https://julialang.org/ — original: \" + e);\n  }\n  throw e;\n}","preventionTips":["Run checkJuliaKernelAvailability before attempting JuliaKernel.start.","Ensure `julia` is on PATH for the exact process/user spawning the kernel.","Resolve juliaup shims to the real binary and pass it as `interpreter`.","Failed probes aren't cached — retry start() after installing Julia."],"tags":["julia","environment","missing-binary","kernel-startup"],"backgroundTag":"runtime-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}