crowdsecurity/crowdsec · error

plugin name %s is invalid. Name should be like {type-name}

Error message

plugin name %s is invalid. Name should be like {type-name}

What it means

getPluginTypeAndSubtypeFromPath derives the plugin type and subtype from the binary's file name by splitting on '-' and requiring at least two parts. If the file name has no '-' separator, the {type-name} convention cannot be parsed and this error is returned.

Source

Thrown at pkg/csplugin/utils.go:72

	g, err := user.LookupGroup(groupname)
	if err != nil {
		return 0, err
	}
	gid, err := strconv.ParseInt(g.Gid, 10, 32)
	if err != nil {
		return 0, err
	}
	if gid < 0 || gid > math.MaxInt32 {
		return 0, errors.New("out of bound gid")
	}
	return uint32(gid), nil
}

func getPluginTypeAndSubtypeFromPath(path string) (string, string, error) {
	pluginFileName := filepath.Base(path)
	parts := strings.Split(pluginFileName, "-")
	if len(parts) < 2 {
		return "", "", fmt.Errorf("plugin name %s is invalid. Name should be like {type-name}", path)
	}
	return strings.Join(parts[:len(parts)-1], "-"), parts[len(parts)-1], nil
}

func getProcessAttr(username string, groupname string) (*unix.SysProcAttr, error) {
	uid, err := getUID(username)
	if err != nil {
		return nil, err
	}
	gid, err := getGID(groupname)
	if err != nil {
		return nil, err
	}

	return &unix.SysProcAttr{
		Credential: &syscall.Credential{
			Uid: uid,
			Gid: gid,

View on GitHub (pinned to 909b515798)

Solutions

  1. Rename the plugin binary to follow the {type}-{subtype} convention, e.g. notification-http
  2. If it's a third-party plugin, check its docs for the required binary naming scheme and keep the '-' separator
  3. Verify the path configured for the plugin points at the correctly named binary

Example fix

# before
cp slack-plugin /etc/crowdsec/plugins/
# after
cp slack-plugin /etc/crowdsec/plugins/notification-slack
Defensive patterns

Strategy: validation

Validate before calling

base := filepath.Base(pluginPath)
if !strings.Contains(base, "-") {
    return fmt.Errorf("plugin binary %q must be named {type}-{name}", base)
}

Try / catch

if err := pluginIsValid(path); err != nil {
    if strings.Contains(err.Error(), "is invalid. Name should be like") {
        log.Fatalf("rename plugin binary to {type}-{name}: %v", err)
    }
    return err
}

Prevention

When it happens

Trigger: A plugin binary in the plugin directory is named without any '-' in its base name (e.g. /etc/crowdsec/plugins/http instead of /etc/crowdsec/plugins/notification-http), so strings.Split on '-' yields one part.

Common situations: Renaming a plugin binary to a shorter name; downloading a plugin whose release artifact name doesn't follow crowdsec's notification-<name> convention; a wrapper script placed in the plugin directory with a custom name.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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