crowdsecurity/crowdsec · error

%s isn't managed by hub

Error message

%s isn't managed by hub

What it means

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.

Source

Thrown at pkg/hubops/disable.go:22

	"context"
	"fmt"
	"os"

	log "github.com/sirupsen/logrus"

	"github.com/crowdsecurity/crowdsec/pkg/cwhub"
)

// RemoveInstallLink removes the item's symlink between the installation directory and the local hub.
func RemoveInstallLink(i *cwhub.Item) error {
	stat, err := os.Lstat(i.State.LocalPath)
	if err != nil {
		return err
	}

	// if it's managed by hub, it's a symlink to csconfig.GConfig.hub.HubDir / ...
	if stat.Mode()&os.ModeSymlink == 0 {
		return fmt.Errorf("%s isn't managed by hub", i.Name)
	}

	target, err := os.Readlink(i.State.LocalPath)
	if err != nil {
		return fmt.Errorf("while reading symlink: %w", err)
	}

	if target != i.State.DownloadPath {
		return fmt.Errorf("%s isn't managed by hub", i.Name)
	}

	if err := os.Remove(i.State.LocalPath); err != nil {
		return fmt.Errorf("while removing symlink: %w", err)
	}

	i.State.LocalPath = ""

	return nil

View on GitHub (pinned to 909b515798)

Solutions

  1. Delete the file manually and re-install the item via 'cscli install'
  2. Confirm with 'ls -l' that the path is a symlink pointing into the hub directory
  3. If it's a local item, remove it manually (the hub intentionally refuses to delete user files)

Example fix

// before
cscli parsers disable my-parser
// error: my-parser isn't managed by hub
// after
rm /etc/crowdsec/parsers/my-parser.yaml
cscli hub update && cscli parsers install my-parser
Defensive patterns

Strategy: validation

Validate before calling

fi, err := os.Lstat(item.State.LocalPath)
if err != nil || fi.Mode()&os.ModeSymlink == 0 {
    return fmt.Errorf("%s is not a hub-managed symlink", item.Name)
}

Type guard

func isHubSymlink(path string) bool {
    fi, err := os.Lstat(path)
    return err == nil && fi.Mode()&os.ModeSymlink != 0
}

Try / catch

if err := hubops.RemoveInstallLink(item); err != nil {
    if strings.Contains(err.Error(), "isn't managed by hub") { /* handle manual file */ }
    return err
}

Prevention

When it happens

Trigger: Calling RemoveInstallLink (via disable/Remove) on an item whose State.LocalPath is a real file, not a symlink to the hub directory.

Common situations: 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.

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


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/a24b6fc9bcc32173. Report an issue: GitHub.