can1357/oh-my-pi · error · Error

fastembed runtime install at ${runtimeDir} has no loadable e

Error message

fastembed runtime install at ${runtimeDir} has no loadable entry

What it means

After mnemopi performs an on-demand 'bun install' of fastembed into a per-version runtime cache, loadFromRuntimeInstall resolves the fastembed entry from the cache's node_modules. If resolveRuntimeModule cannot find a loadable entry, the install claims success but the package is unusable — typically a failed, interrupted, or partially pruned runtime install.

Source

Thrown at packages/mnemopi/src/core/fastembed-runtime.ts:162

	const loaded: FastembedModule = requireFastembed(entry);
	return loaded;
}

async function loadFromRuntimeInstall(): Promise<FastembedModule> {
	const plan = fastembedRuntimeInstallPlan();
	const runtimeDir = await ensureRuntimeInstalled({
		runtimeDir: path.join(getFastembedRuntimeDir(), plan.versionKey),
		install: plan.install,
		probePackage: "fastembed",
	});
	const nodeModules = path.join(runtimeDir, "node_modules");
	// The compiled-binary resolver ignores `main`/`exports` for real-FS bare
	// specifiers (Bun #1763); route the runtime graph's requires (fastembed →
	// onnxruntime-node, @anush008/tokenizers → platform binding, …) through
	// the runtime cache.
	installRuntimeModuleResolver({ runtimeNodeModules: nodeModules });
	const entry = resolveRuntimeModule(nodeModules, "fastembed");
	if (!entry) throw new Error(`fastembed runtime install at ${runtimeDir} has no loadable entry`);
	return loadResolvedFastembed(entry, path.join(nodeModules, "fastembed"));
}

function isRecoverableFastembedLoadError(error: unknown): boolean {
	if (typeof error !== "object" || error === null) return false;
	const { name, code, message } = error as { name?: unknown; code?: unknown; message?: unknown };
	if (name === "ResolveMessage") return true;
	if (code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || code === "ERR_DLOPEN_FAILED") return true;
	return typeof message === "string" && /cannot find (module|package)/i.test(message);
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Delete the fastembed runtime cache directory (the dir containing <versionKey>) and let the next run reinstall it
  2. Check that <runtimeDir>/node_modules/fastembed exists with a valid package.json/entry; if not, the install failed — rerun with the install log visible
  3. Avoid concurrent first-use: ensure only one process triggers the initial runtime install, or pre-warm the cache
  4. Check disk space and write permissions in the cache location

Example fix

// before: partial cache
rm -rf "$(omp cache dir)/fastembed/fastembed-1.0.0_transitive-ort"
// after: next run reinstalls cleanly
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from "node:fs";
import * as path from "node:path";
function runtimeEntryExists(runtimeDir: string): boolean {
  const pkg = path.join(runtimeDir, "node_modules", "fastembed", "package.json");
  return existsSync(pkg);
}
if (!runtimeEntryExists(expectedRuntimeDir)) {
  // delete the runtime cache dir so the next run reinstalls cleanly
}

Type guard

function hasLoadableEntry(e: string | null): e is string {
  return typeof e === "string" && e.length > 0;
}

Try / catch

try {
  await loadFastembed();
} catch (err) {
  if (String(err).includes("has no loadable entry")) {
    await fs.rm(runtimeCacheDir, { recursive: true, force: true });
    await loadFastembed(); // reinstall and retry once
  } else throw err;
}

Prevention

When it happens

Trigger: ensureRuntimeInstalled reports the runtime dir at getFastembedRuntimeDir()/<versionKey> as present, but resolveRuntimeModule(nodeModules, 'fastembed') returns undefined — corrupted runtime cache, an install that skipped the fastembed package, or a cache dir written by a different tool/version.

Common situations: Disk-full or killed install leaving an empty/partial runtime cache that passes the existence probe; parallel processes racing on the same cache dir; filesystem sync issues in containers with the cache on a network volume.

Related errors


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