zellij-org/zellij · error

Worker name not specified in message to worker

Error message

Worker name not specified in message to worker

What it means

post_message_to dispatches a PluginMessage to a plugin worker and requires plugin_message.worker_name to be Some(...). This error fires when the message reaches that function with no worker name, so the router cannot select a worker thread.

Source

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

    context: BTreeMap<String, String>,
) {
    let _ = env
        .senders
        .send_to_background_jobs(BackgroundJob::WebRequest(
            env.plugin_id,
            env.client_id,
            url,
            verb,
            headers,
            body,
            context,
        ));
}

fn post_message_to(env: &PluginEnv, plugin_message: PluginMessage) -> Result<()> {
    let worker_name = plugin_message
        .worker_name
        .ok_or(anyhow!("Worker name not specified in message to worker"))?;
    env.senders
        .send_to_plugin(PluginInstruction::PostMessagesToPluginWorker(
            env.plugin_id,
            env.client_id,
            worker_name,
            vec![(plugin_message.name, plugin_message.payload)],
        ))
}

fn post_message_to_plugin(env: &PluginEnv, plugin_message: PluginMessage) -> Result<()> {
    if let Some(worker_name) = plugin_message.worker_name {
        return Err(anyhow!(
            "Worker name (\"{}\") should not be specified in message to plugin",
            worker_name
        ));
    }
    env.senders
        .send_to_plugin(PluginInstruction::PostMessageToPlugin(

View on GitHub (pinned to 98a0837077)

Solutions

  1. Set worker_name on the message before posting to a worker (it must name a worker the plugin spawned)
  2. Use the correct routing function: messages without a worker go through post_message_to_plugin instead
  3. Check the plugin-side wrapper (post_message_to_worker API) actually forwards the name argument

Example fix

// before
let msg = PluginMessage { name: "task".into(), payload, worker_name: None };
post_message_to(&env, msg)?; // Err: Worker name not specified

// after
let msg = PluginMessage { name: "task".into(), payload, worker_name: Some("worker1".into()) };
post_message_to(&env, msg)?;
Defensive patterns

Strategy: validation

Validate before calling

if plugin_message.worker_name.is_none() {
    return Err(anyhow!("worker_name required before post_message_to"));
}

Type guard

fn is_worker_message(msg: &PluginMessage) -> bool {
    msg.worker_name.is_some()
}

Prevention

When it happens

Trigger: A plugin (or host code) builds a PluginMessage intended for a worker and calls the worker-posting path without setting worker_name — e.g. calling post_message_to_worker semantics on a message constructed for plain plugin delivery, or a worker_name that got dropped while constructing the message.

Common situations: Plugin developers reusing a message struct for both plugin and worker targets and forgetting the worker field; SDK wrapper that defaults worker_name to None.

Related errors


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