{"record":{"id":"189bd9682963d6b7","repo":"can1357/oh-my-pi","slug":"fastembed-runtime-install-at-runtimedir-has-no","errorCode":null,"errorMessage":"fastembed runtime install at ${runtimeDir} has no loadable entry","messagePattern":"fastembed runtime install at (.+?) has no loadable entry","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mnemopi/src/core/fastembed-runtime.ts","lineNumber":162,"sourceCode":"\tconst loaded: FastembedModule = requireFastembed(entry);\n\treturn loaded;\n}\n\nasync function loadFromRuntimeInstall(): Promise<FastembedModule> {\n\tconst plan = fastembedRuntimeInstallPlan();\n\tconst runtimeDir = await ensureRuntimeInstalled({\n\t\truntimeDir: path.join(getFastembedRuntimeDir(), plan.versionKey),\n\t\tinstall: plan.install,\n\t\tprobePackage: \"fastembed\",\n\t});\n\tconst nodeModules = path.join(runtimeDir, \"node_modules\");\n\t// The compiled-binary resolver ignores `main`/`exports` for real-FS bare\n\t// specifiers (Bun #1763); route the runtime graph's requires (fastembed →\n\t// onnxruntime-node, @anush008/tokenizers → platform binding, …) through\n\t// the runtime cache.\n\tinstallRuntimeModuleResolver({ runtimeNodeModules: nodeModules });\n\tconst entry = resolveRuntimeModule(nodeModules, \"fastembed\");\n\tif (!entry) throw new Error(`fastembed runtime install at ${runtimeDir} has no loadable entry`);\n\treturn loadResolvedFastembed(entry, path.join(nodeModules, \"fastembed\"));\n}\n\nfunction isRecoverableFastembedLoadError(error: unknown): boolean {\n\tif (typeof error !== \"object\" || error === null) return false;\n\tconst { name, code, message } = error as { name?: unknown; code?: unknown; message?: unknown };\n\tif (name === \"ResolveMessage\") return true;\n\tif (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\" || code === \"ERR_DLOPEN_FAILED\") return true;\n\treturn typeof message === \"string\" && /cannot find (module|package)/i.test(message);\n}\n","sourceCodeStart":144,"sourceCodeEnd":173,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/mnemopi/src/core/fastembed-runtime.ts#L144-L173","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Delete the fastembed runtime cache directory (the dir containing <versionKey>) and let the next run reinstall it","Check that <runtimeDir>/node_modules/fastembed exists with a valid package.json/entry; if not, the install failed — rerun with the install log visible","Avoid concurrent first-use: ensure only one process triggers the initial runtime install, or pre-warm the cache","Check disk space and write permissions in the cache location"],"exampleFix":"// before: partial cache\nrm -rf \"$(omp cache dir)/fastembed/fastembed-1.0.0_transitive-ort\"\n// after: next run reinstalls cleanly","handlingStrategy":"validation","validationCode":"import { existsSync } from \"node:fs\";\nimport * as path from \"node:path\";\nfunction runtimeEntryExists(runtimeDir: string): boolean {\n  const pkg = path.join(runtimeDir, \"node_modules\", \"fastembed\", \"package.json\");\n  return existsSync(pkg);\n}\nif (!runtimeEntryExists(expectedRuntimeDir)) {\n  // delete the runtime cache dir so the next run reinstalls cleanly\n}","typeGuard":"function hasLoadableEntry(e: string | null): e is string {\n  return typeof e === \"string\" && e.length > 0;\n}","tryCatchPattern":"try {\n  await loadFastembed();\n} catch (err) {\n  if (String(err).includes(\"has no loadable entry\")) {\n    await fs.rm(runtimeCacheDir, { recursive: true, force: true });\n    await loadFastembed(); // reinstall and retry once\n  } else throw err;\n}","preventionTips":["Delete the fastembed runtime cache if an install is interrupted","Avoid concurrent processes performing the first runtime install","Monitor free disk space where the runtime cache lives","Pre-install fastembed as a direct dependency to skip the runtime-install path entirely"],"tags":["runtime-install","cache-corruption","fastembed"],"backgroundTag":"broken-runtime-cache","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}