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

  1. Delete the TTS runtime directory and let the worker reinstall the runtime (re-triggers the kokoro-js install)
  2. Check network/proxy access for the runtime install step and re-run; verify no install errors were swallowed
  3. Verify the installed KOKORO_VERSION matches what the package expects (stale/partial install) and reinstall
  4. 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

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


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