can1357/oh-my-pi · error

Unable to resolve ${TRANSFORMERS_PACKAGE} in runtime at ${no

Error message

Unable to resolve ${TRANSFORMERS_PACKAGE} in runtime at ${nodeModules}

What it means

After resolving kokoro-js in the TTS runtime, loadKokoroRuntime also resolves @huggingface/transformers (TRANSFORMERS_PACKAGE), which kokoro-js needs for the ONNX inference pipeline. If the package is missing from the runtime's node_modules, the worker throws — the runtime install is incomplete even though kokoro-js itself resolved.

Source

Thrown at packages/coding-agent/src/tts/tts-worker.ts:154

			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,
		dtype: ttsDtypeOverride ?? spec.dtype,
		progress_callback: info => sendProgress(transport, requestId, modelKey, info),

View on GitHub (pinned to 9690622007)

Solutions

  1. Remove the runtime directory and retry so the full dependency set (kokoro-js + transformers) is reinstalled
  2. Verify the runtime install logs for the failed transformers download and fix network/proxy access
  3. Ensure the installed versions match the bundled KOKORO_VERSION expectations; reinstall on version mismatch
  4. Check disk space and permissions on the runtime directory

Example fix

// before (partial runtime install)
// kokoro-js present, @huggingface/transformers missing -> throws
// after
$`rm -rf ~/.omp/tts-runtime`; // retry TTS; worker reinstalls both packages
Defensive patterns

Strategy: retry

Validate before calling

const nodeModules = await installSharpStubResolver(runtimeDir);
if (!resolveRuntimeModule(nodeModules, TRANSFORMERS_PACKAGE)) await reinstallTtsRuntime(runtimeDir);

Type guard

function transformersRuntimeReady(nodeModules) {
  return resolveRuntimeModule(nodeModules, TRANSFORMERS_PACKAGE) !== undefined;
}

Try / catch

try {
  runtime = await loadKokoroRuntime();
} catch (err) {
  if (err.message.includes(TRANSFORMERS_PACKAGE)) {
    await resetTtsRuntimeDir(); // delete + reinstall full dependency set
    runtime = await loadKokoroRuntime();
  } else throw err;
}

Prevention

When it happens

Trigger: Loading local TTS when the managed runtime directory contains kokoro-js but not @huggingface/transformers — partial/failed install, interrupted dependency fetch, or a version/packaging change that dropped the transitive dependency.

Common situations: Interrupted first-run install (network drop mid-download); manual deletion or cleanup of node_modules; dependency version drift where transformers is no longer installed alongside kokoro; permissions or disk-space failures during setup.

Related errors


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