{"record":{"id":"a24b6fc9bcc32173","repo":"crowdsecurity/crowdsec","slug":"s-isn-t-managed-by-hub","errorCode":null,"errorMessage":"%s isn't managed by hub","messagePattern":"(.+?) isn't managed by hub","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubops/disable.go","lineNumber":22,"sourceCode":"\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tlog \"github.com/sirupsen/logrus\"\n\n\t\"github.com/crowdsecurity/crowdsec/pkg/cwhub\"\n)\n\n// RemoveInstallLink removes the item's symlink between the installation directory and the local hub.\nfunc RemoveInstallLink(i *cwhub.Item) error {\n\tstat, err := os.Lstat(i.State.LocalPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// if it's managed by hub, it's a symlink to csconfig.GConfig.hub.HubDir / ...\n\tif stat.Mode()&os.ModeSymlink == 0 {\n\t\treturn fmt.Errorf(\"%s isn't managed by hub\", i.Name)\n\t}\n\n\ttarget, err := os.Readlink(i.State.LocalPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while reading symlink: %w\", err)\n\t}\n\n\tif target != i.State.DownloadPath {\n\t\treturn fmt.Errorf(\"%s isn't managed by hub\", i.Name)\n\t}\n\n\tif err := os.Remove(i.State.LocalPath); err != nil {\n\t\treturn fmt.Errorf(\"while removing symlink: %w\", err)\n\t}\n\n\ti.State.LocalPath = \"\"\n\n\treturn nil","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubops/disable.go#L4-L40","documentation":"RemoveInstallLink removes the symlink that installs a hub item into the config directory. If the local path is a regular file rather than a symlink, it is not hub-managed, and the error '%s isn't managed by hub' is returned with the item name.","triggerScenarios":"Calling RemoveInstallLink (via disable/Remove) on an item whose State.LocalPath is a real file, not a symlink to the hub directory.","commonSituations":"User manually copied a config file into the config directory instead of letting the hub link it; leftover file from before hub management was introduced; local (user-created) items that were never symlinked.","solutions":["Delete the file manually and re-install the item via 'cscli install'","Confirm with 'ls -l' that the path is a symlink pointing into the hub directory","If it's a local item, remove it manually (the hub intentionally refuses to delete user files)"],"exampleFix":"// before\ncscli parsers disable my-parser\n// error: my-parser isn't managed by hub\n// after\nrm /etc/crowdsec/parsers/my-parser.yaml\ncscli hub update && cscli parsers install my-parser","handlingStrategy":"validation","validationCode":"fi, err := os.Lstat(item.State.LocalPath)\nif err != nil || fi.Mode()&os.ModeSymlink == 0 {\n    return fmt.Errorf(\"%s is not a hub-managed symlink\", item.Name)\n}","typeGuard":"func isHubSymlink(path string) bool {\n    fi, err := os.Lstat(path)\n    return err == nil && fi.Mode()&os.ModeSymlink != 0\n}","tryCatchPattern":"if err := hubops.RemoveInstallLink(item); err != nil {\n    if strings.Contains(err.Error(), \"isn't managed by hub\") { /* handle manual file */ }\n    return err\n}","preventionTips":["Never replace hub-installed files with plain copies; edit via hub workflows","Check 'cscli hub list' taint/managed status before disabling","Reinstall items after manual config surgery"],"tags":["hub","symlink","item-management"],"backgroundTag":"unsupported-operation","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}