{"record":{"id":"75fe4e8e7757a57e","repo":"xai-org/grok-build","slug":"failed-to-disable-plugin-e","errorCode":null,"errorMessage":"Failed to disable plugin: {e}","messagePattern":"Failed to disable plugin: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/plugin_cmd.rs","lineNumber":631,"sourceCode":"    xai_grok_shell::config::add_enabled_plugin(name)\n        .map_err(|e| anyhow::anyhow!(\"Failed to enable plugin: {e}\"))?;\n    println!(\"Enabled plugin: {name}\");\n    Ok(())\n}\n\nfn cmd_disable(name: &str) -> Result<()> {\n    let registry = InstallRegistry::load();\n    if registry.find_plugin(name).is_none() {\n        bail!(\n            \"Plugin \\\"{name}\\\" not found.\\n\\\n               Run `grok plugin list` to see installed plugins.\"\n        );\n    }\n    if let Err(e) = xai_grok_shell::config::remove_enabled_plugin(name) {\n        tracing::warn!(\"failed to remove from enabled list: {e}\");\n    }\n    xai_grok_shell::config::add_disabled_plugin(name)\n        .map_err(|e| anyhow::anyhow!(\"Failed to disable plugin: {e}\"))?;\n    println!(\"Disabled plugin: {name}\");\n    Ok(())\n}\n\nfn cmd_details(name: &str) -> Result<()> {\n    let registry = InstallRegistry::load();\n    let (repo_key, repo, _) = registry.find_plugin(name).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Plugin \\\"{name}\\\" not found.\\n\\\n             Run `grok plugin list` to see installed plugins.\"\n        )\n    })?;\n\n    let mp = repo\n        .marketplace\n        .as_ref()\n        .map(|mp| format!(\"\\n  source: {}\", mp.source_display_name))\n        .unwrap_or_default();","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/plugin_cmd.rs#L613-L649","documentation":"cmd_disable disables a plugin by removing it from the enabled list (failures there are only warned) and then calling xai_grok_shell::config::add_disabled_plugin. If persisting to the disabled list fails, the underlying error is wrapped as \"Failed to disable plugin: {e}\". It exists to attribute config-persistence failures to the plugin disable command.","triggerScenarios":"Any Err from add_disabled_plugin(name): inability to read/parse or write the config store of disabled plugins — permission denied, missing parent directory, invalid existing config JSON, disk full, read-only filesystem.","commonSituations":"Same root causes as enable: sudo-created config files now unwritable, non-writable HOME in containers, hand-edited config that fails to deserialize, full disk. Also seen when automation disables plugins at startup before the config dir is mounted.","solutions":["Inspect the wrapped {e} to identify whether it's IO or config parsing.","Repair permissions/ownership of the config file and its directory.","Fix or regenerate the corrupted config JSON (keep a backup).","Ensure the environment's config directory exists and is writable before running plugin commands."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn can_persist_disabled_list() -> bool {\n    std::env::var(\"HOME\").ok()\n        .map(|h| std::path::Path::new(&h).join(\".config\").exists())\n        .unwrap_or(false)\n}\n// verify config dir presence/writability before disabling plugins","typeGuard":null,"tryCatchPattern":"match xai_grok_shell::config::add_disabled_plugin(name) {\n    Ok(()) => println!(\"disabled {name}\"),\n    Err(e) => {\n        eprintln!(\"Failed to disable plugin {name}: {e}\");\n        // note: the plugin may still appear enabled since persistence failed\n    }\n}","preventionTips":["Fix ownership of config files created by sudo runs before plugin operations.","Validate the config JSON after any manual editing.","Mount the config directory read-write in automation environments.","Verify the disabled-list state after a failure — the in-memory operation may have partially applied."],"tags":["config","plugins","filesystem","permissions"],"backgroundTag":"config-write-failed","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}