sinelaw/fresh · warning

[pkg] Bundle plugin not found

Error message

[pkg] Bundle plugin not found: ${plugin.entry}

What it means

While activating an installed bundle, pkg.ts iterates manifest.fresh.plugins and calls editor.loadPlugin(entryPath) only if fsLocal.fileExists(entryPath); when the bundle plugin entry file is missing on disk it warns 'Bundle plugin not found: <entry>' and skips loading that plugin instead of failing the whole bundle.

Solutions

  1. Check manifest.fresh.plugins[].entry against the actual files in the installed bundle directory.
  2. Reinstall the bundle to restore missing files (case-sensitive path/casing included).
  3. Fix and republish the bundle so the entry file is included at the declared path.
  4. Remove the stale plugin entry from the manifest if the plugin was intentionally dropped.

Example fix

// manifest
[[fresh.plugins]]
entry = "plugin/main.js"
// after: ensure bundle ships plugin/main.js (watch case: Plugin/Main.js is NOT the same on Linux)
Defensive patterns

Strategy: validation

Validate before calling

for (const p of manifest.fresh?.plugins ?? []) {
  const entryPath = path.join(bundleDir, p.entry);
  if (!fs.existsSync(entryPath)) throw new Error(`bundle missing plugin entry: ${p.entry}`);
}

Type guard

function bundleComplete(manifest, dir) { return (manifest.fresh?.plugins ?? []).every(p => fs.existsSync(path.join(dir, p.entry))); }

Try / catch

try { await loadBundle(bundleDir); } catch (e) { if (e.message.includes('plugin entry')) { editor.warn('bundle incomplete — reinstalling'); await installBundle(bundleUrl); } else throw e; }

Prevention

When it happens

Trigger: An installed bundle's manifest lists a plugin whose entry file does not exist at the expected path inside the bundle directory: bad entry path in the manifest, incomplete install/extraction, or files deleted after install.

Common situations: Publishing a bundle where the plugin 'entry' path has a typo or wrong case (case-sensitive Linux filesystems); archives built without the plugin JS file; partial installs interrupted mid-extraction.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of sinelaw/fresh@67894ca546 (2026-09-13). Data as JSON: /api/errors/f50f2434785b56f4. Report an issue: GitHub.

Appendix: source

Thrown at crates/fresh-editor/plugins/pkg.ts:1701

  // Load all plugins from the bundle
  if (manifest.fresh?.plugins) {
    for (const plugin of manifest.fresh.plugins) {
      let entryPath = editor.pathJoin(packageDir, plugin.entry);

      // Try .js fallback if .ts doesn't exist
      if (!fsLocal.fileExists(entryPath) && entryPath.endsWith(".ts")) {
        const jsPath = entryPath.replace(/\.ts$/, ".js");
        if (fsLocal.fileExists(jsPath)) {
          entryPath = jsPath;
        }
      }

      if (fsLocal.fileExists(entryPath)) {
        editor.debug(`[pkg] Loading bundle plugin: ${plugin.entry}`);
        await editor.loadPlugin(entryPath);
      } else {
        editor.warn(`[pkg] Bundle plugin not found: ${plugin.entry}`);
      }
    }
  }

  // Reload themes if bundle contains any (uses same format as theme-packs)
  if (manifest.fresh?.themes && manifest.fresh.themes.length > 0) {
    editor.debug(`[pkg] Bundle contains ${manifest.fresh.themes.length} theme(s), reloading themes`);
    editor.reloadThemes();
  }

  // Apply grammar changes
  await editor.reloadGrammars();
  editor.debug(`[pkg] Bundle loaded: ${bundleName}`);
}

/**
 * Checkout a specific version in a package directory
 */

View on GitHub (pinned to 67894ca546)