can1357/oh-my-pi · error
Unable to resolve ${KOKORO_PACKAGE} in runtime at ${nodeModu
Error message
Unable to resolve ${KOKORO_PACKAGE} in runtime at ${nodeModules} What it means
The TTS worker sets up an on-device Kokoro runtime inside a managed runtime directory: it installs a sharp stub resolver, then resolves the kokoro-js package entry from that runtime's node_modules. If resolveRuntimeModule cannot find KOKORO_PACKAGE there, loadKokoroRuntime throws, meaning the runtime installation did not produce a usable kokoro-js install.
Source
Thrown at packages/coding-agent/src/tts/tts-worker.ts:152
return kokoroRuntime.load(async () => {
const runtimeDir = await ensureRuntimeInstalled({
runtimeDir: getTtsRuntimeDir(),
install: {
dependencies: { [KOKORO_PACKAGE]: KOKORO_VERSION },
overrides: { [ONNXRUNTIME_NODE_PACKAGE]: ONNXRUNTIME_NODE_VERSION },
trustedDependencies: [ONNXRUNTIME_NODE_PACKAGE],
},
probePackage: KOKORO_PACKAGE,
onPhase: phase =>
transport.send({
type: "progress",
id: requestId,
event: { modelKey, status: phase, name: `${KOKORO_PACKAGE}@${KOKORO_VERSION}` },
}),
});
const nodeModules = await installSharpStubResolver(runtimeDir);
const kokoroEntry = resolveRuntimeModule(nodeModules, KOKORO_PACKAGE);
if (!kokoroEntry) throw new Error(`Unable to resolve ${KOKORO_PACKAGE} in runtime at ${nodeModules}`);
const transformersEntry = resolveRuntimeModule(nodeModules, TRANSFORMERS_PACKAGE);
if (!transformersEntry) throw new Error(`Unable to resolve ${TRANSFORMERS_PACKAGE} in runtime at ${nodeModules}`);
const runtimeRequire = createRequire(kokoroEntry);
configureTransformers(runtimeRequire(transformersEntry) as TransformersEnv);
return runtimeRequire(kokoroEntry) as KokoroRuntime;
});
}
async function loadModelOnDevice(
runtime: KokoroRuntime,
spec: TtsLocalModelSpec,
modelKey: TtsLocalModelKey,
transport: TtsTransport,
requestId: string,
device: KokoroDevice,
): Promise<KokoroTtsInstance> {
return runtime.KokoroTTS.from_pretrained(spec.repo, {
device,View on GitHub (pinned to 9690622007)
Solutions
- Delete the TTS runtime directory and let the worker reinstall the runtime (re-triggers the kokoro-js install)
- Check network/proxy access for the runtime install step and re-run; verify no install errors were swallowed
- Verify the installed KOKORO_VERSION matches what the package expects (stale/partial install) and reinstall
- Check disk space and write permissions on the runtime directory
Example fix
// before (stale runtime dir) // worker resolves kokoro-js from a broken node_modules and throws // after $`rm -rf ~/.omp/tts-runtime`; // then retry TTS so the runtime reinstalls cleanly
Defensive patterns
Strategy: retry
Validate before calling
import { resolveRuntimeModule } from './runtime';
const nodeModules = await installSharpStubResolver(runtimeDir);
if (!resolveRuntimeModule(nodeModules, KOKORO_PACKAGE)) await reinstallTtsRuntime(runtimeDir); Type guard
function kokoroRuntimeReady(nodeModules) {
return resolveRuntimeModule(nodeModules, KOKORO_PACKAGE) !== undefined;
} Try / catch
try {
runtime = await loadKokoroRuntime();
} catch (err) {
if (err.message.includes('Unable to resolve')) {
await resetTtsRuntimeDir(); // delete + reinstall
runtime = await loadKokoroRuntime();
} else throw err;
} Prevention
- Verify network/proxy access before first-run runtime install
- Monitor install logs for partial downloads; delete and reinstall on failure
- Pin/verify runtime versions match the bundled KOKORO_VERSION after upgrades
- Ensure adequate disk space and write permissions on the runtime directory
When it happens
Trigger: Loading local TTS when the runtime directory (runtimeDir) lacks node_modules containing kokoro-js — e.g. the runtime install step failed, was interrupted, or was skipped; a corrupted/partial install; a version bump changed the package layout so resolution fails.
Common situations: Offline or proxied environments where the runtime package download failed; disk-full or permission errors during runtime setup; a stale runtime dir from an older version; antivirus/cleanup tools deleting node_modules contents.
Related errors
- Unable to resolve ${TRANSFORMERS_PACKAGE} in runtime at ${no
- No local TTS model registered for key: ${modelKey ?? DEFAULT
- Audio gain must be a finite non-negative number
- Failed to download the local text-to-speech model.
- Could not resolve ${APP_NAME} binary path in PATH
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/21cdcb6bfb792c55.
Report an issue: GitHub.