{"record":{"id":"a8603e4c3a17c1bb","repo":"zellij-org/zellij","slug":"worker-name-not-specified-in-message-to-worker","errorCode":null,"errorMessage":"Worker name not specified in message to worker","messagePattern":"Worker name not specified in message to worker","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"zellij-server/src/plugins/zellij_exports.rs","lineNumber":2590,"sourceCode":"    context: BTreeMap<String, String>,\n) {\n    let _ = env\n        .senders\n        .send_to_background_jobs(BackgroundJob::WebRequest(\n            env.plugin_id,\n            env.client_id,\n            url,\n            verb,\n            headers,\n            body,\n            context,\n        ));\n}\n\nfn post_message_to(env: &PluginEnv, plugin_message: PluginMessage) -> Result<()> {\n    let worker_name = plugin_message\n        .worker_name\n        .ok_or(anyhow!(\"Worker name not specified in message to worker\"))?;\n    env.senders\n        .send_to_plugin(PluginInstruction::PostMessagesToPluginWorker(\n            env.plugin_id,\n            env.client_id,\n            worker_name,\n            vec![(plugin_message.name, plugin_message.payload)],\n        ))\n}\n\nfn post_message_to_plugin(env: &PluginEnv, plugin_message: PluginMessage) -> Result<()> {\n    if let Some(worker_name) = plugin_message.worker_name {\n        return Err(anyhow!(\n            \"Worker name (\\\"{}\\\") should not be specified in message to plugin\",\n            worker_name\n        ));\n    }\n    env.senders\n        .send_to_plugin(PluginInstruction::PostMessageToPlugin(","sourceCodeStart":2572,"sourceCodeEnd":2608,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/zellij-server/src/plugins/zellij_exports.rs#L2572-L2608","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set worker_name on the message before posting to a worker (it must name a worker the plugin spawned)","Use the correct routing function: messages without a worker go through post_message_to_plugin instead","Check the plugin-side wrapper (post_message_to_worker API) actually forwards the name argument"],"exampleFix":"// before\nlet msg = PluginMessage { name: \"task\".into(), payload, worker_name: None };\npost_message_to(&env, msg)?; // Err: Worker name not specified\n\n// after\nlet msg = PluginMessage { name: \"task\".into(), payload, worker_name: Some(\"worker1\".into()) };\npost_message_to(&env, msg)?;","handlingStrategy":"validation","validationCode":"if plugin_message.worker_name.is_none() {\n    return Err(anyhow!(\"worker_name required before post_message_to\"));\n}","typeGuard":"fn is_worker_message(msg: &PluginMessage) -> bool {\n    msg.worker_name.is_some()\n}","tryCatchPattern":null,"preventionTips":["Always set worker_name when targeting a worker; assert it before posting","Keep worker-bound and plugin-bound message construction in separate helper functions"],"tags":["plugin","worker","api-misuse","message-routing"],"backgroundTag":null,"analyzedSha":"98a0837077492d53dd252ab30bc3e43e41e504f4","analyzedAt":"2026-08-16T13:02:01.396Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}