can1357/oh-my-pi · error · Error
Unable to resolve ${SHERPA_PACKAGE} in compiled runtime at $
Error message
Unable to resolve ${SHERPA_PACKAGE} in compiled runtime at ${nodeModules} What it means
In a compiled binary, the native sherpa-onnx addon is installed into a side runtime directory (node_modules under the STT runtime dir) and resolved via resolveRuntimeModule before being loaded with createRequire. If, after the ensureRuntimeInstalled step, the package entry still cannot be found at that node_modules path, the worker throws — the runtime install did not produce a loadable package.
Source
Thrown at packages/coding-agent/src/stt/asr-worker.ts:164
* Memoized so the runtime loads once per process.
*/
function loadSherpaRuntime(transport: SttTransport, requestId: string, modelKey: SttModelKey): Promise<SherpaRuntime> {
return sherpaRuntime.load(async () => {
if (!isCompiledBinary()) return loadSourceSherpaRuntime(import.meta.url);
const runtimeDir = await ensureRuntimeInstalled({
runtimeDir: getSherpaRuntimeDir(),
install: { dependencies: { [SHERPA_PACKAGE]: getSherpaVersionSpec() } },
probePackage: SHERPA_PACKAGE,
onPhase: phase =>
transport.send({
type: "progress",
id: requestId,
event: { modelKey, status: phase, name: `${SHERPA_PACKAGE}@${getSherpaVersionSpec()}` },
}),
});
const nodeModules = path.join(runtimeDir, "node_modules");
const entry = resolveRuntimeModule(nodeModules, SHERPA_PACKAGE);
if (!entry) throw new Error(`Unable to resolve ${SHERPA_PACKAGE} in compiled runtime at ${nodeModules}`);
return createRequire(entry)(entry) as SherpaRuntime;
});
}
async function loadPipelineOnDevice(
transformers: TransformersRuntime,
spec: TransformersSttModelSpec,
modelKey: SttModelKey,
transport: SttTransport,
requestId: string,
device: TinyModelDevice,
): Promise<AutomaticSpeechRecognitionPipeline> {
return transformers.pipeline(ASR_TASK, spec.repo, {
device,
dtype: sttModelDtypeOverride ?? spec.dtype,
progress_callback: info => sendProgress(transport, requestId, modelKey, info),
});
}View on GitHub (pinned to 9690622007)
Solutions
- Delete the stale STT runtime directory under the tiny-models cache (…/stt-runtime/sherpa-*) and retry so ensureRuntimeInstalled reinstalls cleanly.
- Check disk space and directory permissions for the cache dir.
- Ensure your antivirus/security software is not removing .node native modules.
- If it persists, verify the installed sherpa-onnx version actually ships a resolvable entry for your platform.
Example fix
// before rm -rf ~/.cache/omp/tiny-models/stt-runtime/sherpa-* # then retry the model load // after ensureRuntimeInstalled(...) succeeds and resolveRuntimeModule finds the entry
Defensive patterns
Strategy: try-catch
Validate before calling
const entry = resolveRuntimeModule(path.join(runtimeDir, "node_modules"), "sherpa-onnx-node");
if (!entry) await ensureRuntimeInstalled({ runtimeDir, install: { dependencies: { "sherpa-onnx-node": spec } }, probePackage: "sherpa-onnx-node" }); Try / catch
try { const runtime = await loadSherpaRuntime(transport, id, modelKey); } catch (err) { await rm(runtimeDir, { recursive: true, force: true }); /* retry once to reinstall the side runtime */ } Prevention
- On failure, wipe the versioned stt-runtime dir and reinstall rather than retrying against a corrupt tree.
- Monitor disk space and permissions on the shared cache directory.
- Exclude native .node files from antivirus scanning on end-user machines.
When it happens
Trigger: Loading any sherpa STT model in a compiled binary when resolveRuntimeModule(runtimeDir/node_modules, "sherpa-onnx-node") returns null — install failed silently, was interrupted, or the runtime dir is corrupt/partial.
Common situations: Disk-full or permission errors during the side runtime install, an interrupted first run leaving a partial runtime dir, antivirus quarantining native .node binaries, or a version-spec/install mismatch pointing at an incomplete tree.
Related errors
- No stt model devices configured
- Unknown stt model: ${modelKey}
- Failed to download speech model (${spec.repo})${detail}
- Speech model download finished without required files (${spe
- Cannot find module onnxruntime-node beside ${fastembedEntry}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/5255a96ed8c88923.
Report an issue: GitHub.