{"record":{"id":"c5a42e37c415259b","repo":"Hmbown/CodeWhale","slug":"reviewed-plugin-stage-could-not-be-opened-for-laun","errorCode":null,"errorMessage":"reviewed plugin stage could not be opened for launch","messagePattern":"reviewed plugin stage could not be opened for launch","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":663,"sourceCode":"    }\n\n    pub(crate) fn prepare_stdio_launch(\n        &self,\n        server_name: &str,\n        command: &str,\n        args: &[String],\n        cwd: Option<&Path>,\n    ) -> Result<ReviewedStdioLaunch> {\n        self.validate_before_stdio_spawn(server_name)?;\n        let staged_root = self\n            .authority\n            .staged_manifest\n            .parent()\n            .context(\"reviewed plugin stage manifest has no parent\")?;\n        let validated = crate::plugins::manifest::PluginManifest::validate_from_path(\n            &self.authority.staged_manifest,\n        )\n        .map_err(|_| anyhow::anyhow!(\"reviewed plugin stage could not be opened for launch\"))?;\n        if validated.content_hash != self.authority.content_hash\n            || validated.capability_hash != self.authority.capability_hash\n        {\n            anyhow::bail!(\"reviewed plugin stage changed before stdio launch\");\n        }\n\n        let mut launch = ReviewedStdioLaunch {\n            command: std::ffi::OsString::from(command),\n            args: args.iter().map(std::ffi::OsString::from).collect(),\n            cwd: cwd.map(Path::to_path_buf),\n            opened_files: Vec::new(),\n            #[cfg(unix)]\n            cwd_fd: None,\n        };\n        if Path::new(command).is_absolute() {\n            launch.bind_command(staged_root, Path::new(command), &validated.file_hashes)?;\n        }\n        for (index, argument) in args.iter().enumerate() {","sourceCodeStart":645,"sourceCodeEnd":681,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/mcp.rs#L645-L681","documentation":"Before launching a reviewed plugin's stdio MCP server, the staged manifest is re-validated (PluginManifest::validate_from_path); failure refuses the launch with this error. The staged copy of the plugin under the stage root is missing, unreadable, or fails its own manifest validation, so the reviewed bundle can no longer be opened at all.","triggerScenarios":"Stage directory deleted or partially cleaned (tmp cleaner, cache purge), staged manifest corrupted or truncated (disk full during staging), permissions changed under the stage root, or a version-skewed stage left by an interrupted plugin update.","commonSituations":"System tmp cleaners removing stage directories, disk-full corrupting staged files, concurrent plugin updates, home-directory copies or restores that break stage contents.","solutions":["Run /plugin reload to restage the plugin from its reviewed source, then retry the launch","If reload keeps failing, inspect the stage root for missing or corrupt files","Reinstall or re-import the plugin bundle and redo the review/enable flow","Exclude the stage directory from tmp cleaners and backup pruning so the stage survives"],"exampleFix":"# error: reviewed plugin stage could not be opened for launch\n/plugin reload\n/plugin show <name>\n/plugin enable <name>","handlingStrategy":"retry","validationCode":"// Before launch, confirm the staged manifest exists and parses\nfn stage_openable(manifest: &std::path::Path) -> bool {\n    manifest.is_file()\n        && std::fs::read(manifest)\n            .ok()\n            .and_then(|b| serde_json::from_slice::<serde_json::Value>(&b).ok())\n            .is_some()\n}","typeGuard":null,"tryCatchPattern":"// On refusal, restage once via the documented flow, then give up loudly\nif launch_err.to_string().contains(\"could not be opened for launch\") {\n    reload_plugin(&name)?;            // /plugin reload\n    retrust_and_enable(&name)?;       // trust command + /plugin enable\n    return relaunch_once(&name);\n}","preventionTips":["Keep plugin stage directories out of tmp-cleaner and cache-prune paths","Restage after OS restores or home-directory copies","Treat repeated stage-open failures as corruption and reinstall the bundle","Automate /plugin reload after bulk plugin updates"],"tags":["plugin","mcp","staging","security","integrity"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}