{"record":{"id":"5c6e4db38c601e5a","repo":"xai-org/grok-build","slug":"failed-to-enable-plugin-e","errorCode":null,"errorMessage":"Failed to enable plugin: {e}","messagePattern":"Failed to enable plugin: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/plugin_cmd.rs","lineNumber":614,"sourceCode":"            }\n        }\n    }\n    Ok(())\n}\n\nfn cmd_enable(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_disabled_plugin(name) {\n        tracing::warn!(\"failed to remove from disabled list: {e}\");\n    }\n    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}\");","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/plugin_cmd.rs#L596-L632","documentation":"cmd_enable enables a plugin by first removing it from the disabled list (failures there are only warned about) and then calling xai_grok_shell::config::add_enabled_plugin. If adding to the enabled list fails, the underlying error is wrapped as \"Failed to enable plugin: {e}\". The library throws it to surface config-persistence problems to the plugin enable command's caller.","triggerScenarios":"Any Err from add_enabled_plugin(name): typically failure to read or write the config file where enabled plugins are recorded (permission denied, missing directory, corrupted/unparseable config, disk full).","commonSituations":"Config file owned by root or another user after running with sudo; HOME/XDG config dir not writable in containers or CI; config JSON hand-edited into invalid state so load-then-save fails; read-only mounted home directory.","solutions":["Read the underlying {e} after the prefix — it names the config file/IO or parse problem.","Fix permissions on the config file/directory (chown/chmod) or run as the owning user.","If the config file is corrupted, back it up and repair or regenerate the JSON.","Ensure the config directory exists and the filesystem is writable (disk space, mount ro/rw)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn config_writable() -> bool {\n    xai_grok_shell::config::config_path()\n        .and_then(|p| p.parent().map(|d| d.exists()))\n        .unwrap_or(false)\n}\n// additionally attempt a no-op write or check metadata permissions before enabling","typeGuard":null,"tryCatchPattern":"match xai_grok_shell::config::add_enabled_plugin(name) {\n    Ok(()) => println!(\"enabled {name}\"),\n    Err(e) => {\n        eprintln!(\"Failed to enable plugin {name}: {e}\");\n        eprintln!(\"check config file permissions and JSON validity\");\n    }\n}","preventionTips":["Don't run the tool with sudo — it makes config files owned by root.","Keep the config file valid JSON; validate after hand edits.","Ensure the config directory exists and is writable in containers/CI images.","Check disk space and mount flags (ro vs rw) on the home volume."],"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"}