zellij-org/zellij · error · anyhow::Error

Failed to parse plugin location: {}

Error message

Failed to parse plugin location: {}

What it means

start_or_reload_plugin converts a plugin URL string into a RunPluginOrAlias via RunPluginOrAlias::from_url, resolving file: paths, plugin aliases, and built-in plugin names against the cwd. This error means the URL could not be parsed or its target could not be resolved to an actual plugin artifact.

Source

Thrown at zellij-server/src/plugins/zellij_exports.rs:3292

    let tab_id: FocusOrCreateTabResponse = result.and_then(|r| r.affected_tab_id);

    let response = ProtobufFocusOrCreateTabResponse::from(tab_id);
    wasi_write_object(env, &response.encode_to_vec()).non_fatal();
}

fn go_to_tab(env: &PluginEnv, tab_index: u32) {
    let error_msg = || format!("failed to change tab focus in plugin {}", env.name());
    let action = Action::GoToTab {
        index: tab_index + 1,
    };
    apply_action!(action, error_msg, env);
}

fn start_or_reload_plugin(env: &PluginEnv, url: &str) -> Result<()> {
    let error_msg = || format!("failed to start or reload plugin in plugin {}", env.name());
    let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
    let run_plugin_or_alias = RunPluginOrAlias::from_url(url, &None, None, Some(cwd))
        .map_err(|e| anyhow!("Failed to parse plugin location: {}", e))?;
    let action = Action::StartOrReloadPlugin {
        plugin: run_plugin_or_alias,
    };
    apply_action!(action, error_msg, env);
    Ok(())
}

fn close_terminal_pane(env: &PluginEnv, terminal_pane_id: u32) {
    let error_msg = || format!("failed to change tab focus in plugin {}", env.name());
    let action = Action::CloseTerminalPane {
        pane_id: terminal_pane_id,
    };
    apply_action!(action, error_msg, env);
    env.senders
        .send_to_pty(PtyInstruction::ClosePane(
            PaneId::Terminal(terminal_pane_id),
            None,
        ))

View on GitHub (pinned to 98a0837077)

Solutions

  1. Check the {} detail — it distinguishes unknown alias, bad scheme, and file-not-found
  2. For file URLs use an absolute path: file:/home/user/plugin.wasm
  3. If using an alias, make sure it is declared under plugin_aliases in the user config
  4. Verify the file exists and is a valid .wasm built for WASI

Example fix

// before
start_or_reload_plugin(&env, "file:./plugin.wasm")?; // relative to server cwd, may miss

// after
start_or_reload_plugin(&env, &format!("file:{}", wasm_path.display()))?; // absolute path
Defensive patterns

Strategy: validation

Validate before calling

fn resolvable_plugin_url(url: &str, aliases: &PluginAliases) -> bool {
    url.starts_with("file:") && std::path::Path::new(url.trim_start_matches("file:")).exists()
        || aliases.contains(url)
        || BUILTIN_PLUGINS.contains(&url)
}

Try / catch

match RunPluginOrAlias::from_url(url, &None, None, Some(cwd.clone())) {
    Ok(p) => apply_action!(Action::StartOrReloadPlugin { plugin: p }, error_msg, env),
    Err(e) => log::warn!("bad plugin location {url}: {e}"),
}

Prevention

When it happens

Trigger: Passing a URL with an unsupported scheme, a malformed path, a plugin alias that is not configured in the user's plugin aliases, or a file: path that does not exist / is not a .wasm file.

Common situations: Plugin marketplaces/managers calling start_or_reload_plugin with user-entered URLs; aliases defined in one machine's config but missing on another; relative paths resolved against a cwd that moved.

Understand the failure class

Related errors


AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16). Data as JSON: /api/errors/9cdb8fa60934758b. Report an issue: GitHub.