{"record":{"id":"d765b45d48ebf50f","repo":"zellij-org/zellij","slug":"worker-name-should-not-be-specified-in-mess","errorCode":null,"errorMessage":"Worker name (\"{}\") should not be specified in message to plugin","messagePattern":"Worker name \\(\"(.+?)\"\\) should not be specified in message to plugin","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"zellij-server/src/plugins/zellij_exports.rs","lineNumber":2602,"sourceCode":"        ));\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(\n            env.plugin_id,\n            env.client_id,\n            plugin_message.name,\n            plugin_message.payload,\n        ))\n}\n\nfn hide_self(env: &PluginEnv) -> Result<()> {\n    env.senders\n        .send_to_screen(ScreenInstruction::SuppressPane(\n            PaneId::Plugin(env.plugin_id),\n            env.client_id,","sourceCodeStart":2584,"sourceCodeEnd":2620,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/zellij-server/src/plugins/zellij_exports.rs#L2584-L2620","documentation":"The inverse guard of error 46: post_message_to_plugin rejects any PluginMessage that carries a worker_name. Plugin-bound messages must have worker_name None; worker-bound ones must go through the worker path.","triggerScenarios":"Calling the plugin-message path with a message whose worker_name is Some(...) — usually a copy-paste of worker-message construction, or a fallback that reuses one message type for both destinations without clearing the field.","commonSituations":"Plugin codebases with a single `post_message` helper that sometimes targets workers; SDKs that populate worker_name eagerly for all messages.","solutions":["Clear worker_name (set it to None) before routing a message to a plugin","Split into two constructors: one for worker messages, one for plugin messages, so the field cannot be set on the wrong path","Route messages that legitimately have a worker_name through post_message_to instead"],"exampleFix":"// before\nlet msg = PluginMessage { name: \"evt\".into(), payload, worker_name: Some(\"w\".into()) };\npost_message_to_plugin(&env, msg)?; // Err\n\n// after\nlet msg = PluginMessage { name: \"evt\".into(), payload, worker_name: None };\npost_message_to_plugin(&env, msg)?;","handlingStrategy":"validation","validationCode":"if plugin_message.worker_name.is_some() {\n    return Err(anyhow!(\"worker_name must be None for plugin-bound messages\"));\n}","typeGuard":"fn is_plugin_message(msg: &PluginMessage) -> bool {\n    msg.worker_name.is_none()\n}","tryCatchPattern":null,"preventionTips":["Route messages through dedicated constructors so worker_name cannot leak into plugin-bound paths"],"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"}