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
- Remove the runtime directory and retry so the full dependency set (kokoro-js + transformers) is reinstalled
- Verify the runtime install logs for the failed transformers download and fix network/proxy access
- Ensure the installed versions match the bundled KOKORO_VERSION expectations; reinstall on version mismatch
- 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
- Treat kokoro-js resolution success as insufficient — check transformers too before use
- Guard first-run installs against network interruptions; retry full reinstalls
- Keep the runtime directory versioned with the app so stale installs are bypassed
- Check disk space and permissions when setup repeatedly fails midway
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
- Unable to resolve ${KOKORO_PACKAGE} in runtime at ${nodeModu
- 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/a414a01d06bbcf05.
Report an issue: GitHub.