{"record":{"id":"b9f320760afb36ac","repo":"crowdsecurity/crowdsec","slug":"while-disabling-s-w","errorCode":null,"errorMessage":"while disabling %s: %w","messagePattern":"while disabling (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubops/disable.go","lineNumber":94,"sourceCode":"\t\tif !sub.State.IsInstalled() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := plan.AddCommand(NewDisableCommand(sub, c.Force)); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\treturn true, nil\n}\n\nfunc (c *DisableCommand) Run(_ context.Context, plan *ActionPlan) error {\n\ti := c.Item\n\n\tfmt.Fprintln(os.Stdout, \"disabling \" + colorizeItemName(i.FQName()))\n\n\tif err := RemoveInstallLink(i); err != nil {\n\t\treturn fmt.Errorf(\"while disabling %s: %w\", i.FQName(), err)\n\t}\n\n\tplan.ReloadNeeded = true\n\n\ti.State.Tainted = false\n\n\treturn nil\n}\n\nfunc (*DisableCommand) OperationType() string {\n\treturn \"disable\"\n}\n\nfunc (c *DisableCommand) ItemType() string {\n\treturn c.Item.Type\n}\n\nfunc (c *DisableCommand) Detail() string {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubops/disable.go#L76-L112","documentation":"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).","triggerScenarios":"Running 'cscli <type> disable <item>' where RemoveInstallLink fails for the item (missing symlink, foreign symlink target, or permission error).","commonSituations":"Item was overwritten or replaced by a non-hub file; stale symlinks after a config migration; running without write permission to the config directory.","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"],"exampleFix":"// before\ncscli parsers disable crowdsecurity/apache2-logs\n// error: while disabling ...\n// after\nls -l /etc/crowdsec/parsers/s01-parse/apache2-logs.yaml\ncscli parsers install crowdsecurity/apache2-logs  # restore correct symlink\ncscli parsers disable crowdsecurity/apache2-logs","handlingStrategy":"try-catch","validationCode":"fi, err := os.Lstat(item.State.LocalPath)\nif err != nil || fi.Mode()&os.ModeSymlink == 0 { return fmt.Errorf(\"item not hub-managed: %s\", item.FQName()) }","typeGuard":null,"tryCatchPattern":"if err := disableCmd.Run(ctx, plan); err != nil {\n    log.Warnf(\"disable failed: %v — reinstall the item to restore hub management\", err)\n    return err\n}","preventionTips":["Verify items are installed via the hub, not manually copied","Use 'cscli hub list' to inspect state before disable operations","Avoid concurrent cscli invocations"],"tags":["cli","hub","disable"],"backgroundTag":"unsupported-operation","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}