xai-org/grok-build · error
Failed to disable plugin: {e}
Error message
Failed to disable plugin: {e} What it means
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.
Source
Thrown at crates/codegen/xai-grok-pager/src/plugin_cmd.rs:631
xai_grok_shell::config::add_enabled_plugin(name)
.map_err(|e| anyhow::anyhow!("Failed to enable plugin: {e}"))?;
println!("Enabled plugin: {name}");
Ok(())
}
fn cmd_disable(name: &str) -> Result<()> {
let registry = InstallRegistry::load();
if registry.find_plugin(name).is_none() {
bail!(
"Plugin \"{name}\" not found.\n\
Run `grok plugin list` to see installed plugins."
);
}
if let Err(e) = xai_grok_shell::config::remove_enabled_plugin(name) {
tracing::warn!("failed to remove from enabled list: {e}");
}
xai_grok_shell::config::add_disabled_plugin(name)
.map_err(|e| anyhow::anyhow!("Failed to disable plugin: {e}"))?;
println!("Disabled plugin: {name}");
Ok(())
}
fn cmd_details(name: &str) -> Result<()> {
let registry = InstallRegistry::load();
let (repo_key, repo, _) = registry.find_plugin(name).ok_or_else(|| {
anyhow::anyhow!(
"Plugin \"{name}\" not found.\n\
Run `grok plugin list` to see installed plugins."
)
})?;
let mp = repo
.marketplace
.as_ref()
.map(|mp| format!("\n source: {}", mp.source_display_name))
.unwrap_or_default();View on GitHub (pinned to bc7f02eddd)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
fn can_persist_disabled_list() -> bool {
std::env::var("HOME").ok()
.map(|h| std::path::Path::new(&h).join(".config").exists())
.unwrap_or(false)
}
// verify config dir presence/writability before disabling plugins Try / catch
match xai_grok_shell::config::add_disabled_plugin(name) {
Ok(()) => println!("disabled {name}"),
Err(e) => {
eprintln!("Failed to disable plugin {name}: {e}");
// note: the plugin may still appear enabled since persistence failed
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to enable plugin: {e}
- unmount {}: {err}
- bind {}: {e}
- clear failed
- hook write-deny ensure failed: {e}
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/75fe4e8e7757a57e.
Report an issue: GitHub.