crowdsecurity/crowdsec · error
while disabling %s: %w
Error message
while disabling %s: %w
What it means
DisableCommand.Run disables an item by calling RemoveInstallLink and wrapping any failure as 'while disabling %s: %w' with the item's FQName. It reports that the disable operation itself could not complete, for any of the underlying reasons (not a symlink, wrong target, removal failed).
Source
Thrown at pkg/hubops/disable.go:94
if !sub.State.IsInstalled() {
continue
}
if err := plan.AddCommand(NewDisableCommand(sub, c.Force)); err != nil {
return false, err
}
}
return true, nil
}
func (c *DisableCommand) Run(_ context.Context, plan *ActionPlan) error {
i := c.Item
fmt.Fprintln(os.Stdout, "disabling " + colorizeItemName(i.FQName()))
if err := RemoveInstallLink(i); err != nil {
return fmt.Errorf("while disabling %s: %w", i.FQName(), err)
}
plan.ReloadNeeded = true
i.State.Tainted = false
return nil
}
func (*DisableCommand) OperationType() string {
return "disable"
}
func (c *DisableCommand) ItemType() string {
return c.Item.Type
}
func (c *DisableCommand) Detail() string {View on GitHub (pinned to 909b515798)
Solutions
- Inspect the item's file in the config directory and restore hub management (reinstall the item)
- Run with proper privileges
- Check the wrapped inner error to distinguish 'not managed by hub' from a permission failure
Example fix
// before cscli parsers disable crowdsecurity/apache2-logs // error: while disabling ... // after ls -l /etc/crowdsec/parsers/s01-parse/apache2-logs.yaml cscli parsers install crowdsecurity/apache2-logs # restore correct symlink cscli parsers disable crowdsecurity/apache2-logs
Defensive patterns
Strategy: try-catch
Validate before calling
fi, err := os.Lstat(item.State.LocalPath)
if err != nil || fi.Mode()&os.ModeSymlink == 0 { return fmt.Errorf("item not hub-managed: %s", item.FQName()) } Try / catch
if err := disableCmd.Run(ctx, plan); err != nil {
log.Warnf("disable failed: %v — reinstall the item to restore hub management", err)
return err
} Prevention
- Verify items are installed via the hub, not manually copied
- Use 'cscli hub list' to inspect state before disable operations
- Avoid concurrent cscli invocations
When it happens
Trigger: Running 'cscli <type> disable <item>' where RemoveInstallLink fails for the item (missing symlink, foreign symlink target, or permission error).
Common situations: Item was overwritten or replaced by a non-hub file; stale symlinks after a config migration; running without write permission to the config directory.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- ErrUserCanceled
- %s is tainted, use '--force' to remove
- %s is tainted, use '--force' to remove
- no appsec_config provided
- no hub configuration provided
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/b9f320760afb36ac.
Report an issue: GitHub.