diegosouzapw/OmniRoute · error

Plugin directory ' ' does not exist

Error message

Plugin directory '${row.pluginDir}' does not exist

What it means

During activation, realpath(row.pluginDir) failed because the directory recorded in the DB no longer exists on disk — the plugin was deleted externally or the data dir moved. Throws instead of half-loading a missing plugin.

Solutions

  1. Reinstall the plugin to recreate its directory
  2. Uninstall the stale plugin entry to clean up the DB row
  3. Restore the plugin directory from backup if it was removed accidentally
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/lib/plugins/manager.ts:391 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/28323f545fb4ee5b. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/plugins/manager.ts:391

  async activate(name: string): Promise<void> {
    const row = getPluginByName(name);
    if (!row) throw new Error(`Plugin '${name}' not found`);
    // Guard on in-memory state, not DB status. DB status survives a restart but
    // loadedPlugins/hooks do not, so a DB-only check makes activate() a no-op for
    // every plugin already marked active — including the loadAll() boot path, whose
    // whole job is reloading exactly those. Hooks being fail-open, the plugin then
    // silently enforces nothing while the UI still reports it as active.
    if (row.status === "active" && this.loadedPlugins.has(name)) return;

    const manifest = JSON.parse(row.manifest) as PluginManifestWithDefaults;

    // Path traversal guard: use realpath to resolve symlinks
    const entryPoint = join(row.pluginDir, manifest.main);
    let resolvedPluginDir: string;
    try {
      resolvedPluginDir = await realpath(row.pluginDir);
    } catch {
      throw new Error(`Plugin directory '${row.pluginDir}' does not exist`);
    }
    const resolvedEntry = await realpath(entryPoint).catch(() => null);
    if (
      !resolvedEntry ||
      (!resolvedEntry.startsWith(resolvedPluginDir + sep) && resolvedEntry !== resolvedPluginDir)
    ) {
      throw new Error(`Plugin '${name}' entry point escapes plugin directory`);
    }

    try {
      const loaded = await loadPlugin(entryPoint, manifest);

      const hookNames: LifecycleHookName[] = [
        "onRequest",
        "onResponse",
        "onError",
        "onInstall",
        "onActivate",

View on GitHub (pinned to a179ffed5b)