sinelaw/fresh · error

Plugin system not active

Error message

Plugin system not active

What it means

`PluginManager::unload_plugin` requires the plugins feature: `self.inner` holds the real manager only when the crate is compiled with `#[cfg(feature = "plugins")]`. When built without the feature, `inner` is None and unloading fails with "Plugin system not active" (when built with the feature but not initialized, the same None triggers it). A no-op Ok(()) is returned instead only in non-plugin builds' cfg branch — the error arm is the cfg(feature) path where inner wasn't initialized.

Solutions

  1. Rebuild with the plugins feature enabled: `cargo build --features plugins` (or use a build that includes it).
  2. Ensure the plugin manager is initialized at startup so `inner` is Some before unload.
  3. Check the editor's build info to confirm whether plugins are compiled in before enabling plugins in config.

Example fix

// before: built without the feature
cargo build --release
let _ = manager.unload_plugin("my-plugin"); // Plugin system not active
// after
cargo build --release --features plugins
let _ = manager.unload_plugin("my-plugin");
Defensive patterns

Strategy: validation

Validate before calling

// caller-side pre-check before touching plugin APIs
fn plugins_active(m: &PluginManager) -> bool { m.inner.is_some() }

Type guard

pub fn is_plugin_ready(m: &PluginManager) -> bool {
    cfg!(feature = "plugins") && m.inner.is_some()
}

Try / catch

match manager.unload_plugin("my-plugin") {
    Err(e) if e.to_string() == "Plugin system not active" => {
        eprintln!("this build lacks the plugins feature; rebuild with --features plugins");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `unload_plugin(name)` on a manager whose `inner` is None: the binary was compiled without the `plugins` cargo feature wired to inner, or the manager was constructed without initializing the plugin backend.

Common situations: Running an official build without the plugins feature and calling plugin-management APIs; config enables a plugin but the binary lacks the feature; forgetting to call the manager's initialization before unload.

Related errors


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

Appendix: source

Thrown at crates/fresh-editor/src/services/plugins/manager.rs:226

    /// Load plugins from a directory with config support (no-op when plugins disabled).
    #[cfg(not(feature = "plugins"))]
    pub fn load_plugins_from_dir_with_config(
        &self,
        dir: &Path,
        plugin_configs: &HashMap<String, PluginConfig>,
    ) -> (Vec<String>, HashMap<String, PluginConfig>) {
        let _ = (dir, plugin_configs);
        (Vec::new(), HashMap::new())
    }

    /// Unload a plugin by name.
    pub fn unload_plugin(&self, name: &str) -> anyhow::Result<()> {
        #[cfg(feature = "plugins")]
        {
            self.inner
                .as_ref()
                .ok_or_else(|| anyhow::anyhow!("Plugin system not active"))?
                .unload_plugin(name)
        }
        #[cfg(not(feature = "plugins"))]
        {
            let _ = name;
            Ok(())
        }
    }

    /// Load a single plugin by path.
    pub fn load_plugin(&self, path: &Path) -> anyhow::Result<()> {
        #[cfg(feature = "plugins")]
        {
            self.inner
                .as_ref()
                .ok_or_else(|| anyhow::anyhow!("Plugin system not active"))?
                .load_plugin(path)
        }

View on GitHub (pinned to 67894ca546)