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

This error is thrown by getPluginTypeAndSubtypeFromPath when a notification plugin binary's filename does not split into at least two dash-separated parts. CrowdSec expects plugin binaries to be named {type-name}, e.g. 'notification-slack' where type='notification' and name='slack'; the type and subtype are derived purely from the filename.

Source

Thrown at pkg/csplugin/utils_windows.go:224

	}, nil
}

func (*PluginBroker) CreateCmd(ctx context.Context, binaryPath string) (*exec.Cmd, error) {
	var err error
	cmd := exec.CommandContext(ctx, binaryPath)
	cmd.SysProcAttr, err = getProcessAttr()
	if err != nil {
		return nil, fmt.Errorf("while getting process attributes: %w", err)
	}
	return cmd, err
}

func getPluginTypeAndSubtypeFromPath(path string) (string, string, error) {
	pluginFileName := strings.TrimSuffix(filepath.Base(path), filepath.Ext(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 pluginIsValid(path string) error {
	var err error

	// check if it exists
	if _, err = os.Stat(path); err != nil {
		return fmt.Errorf("plugin at %s does not exist", path)
	}

	// check if it is owned by root
	err = CheckPerms(path)
	if err != nil {
		return err
	}

View on GitHub (pinned to 909b515798)

Solutions

  1. Rename the plugin binary to include a dash, format {type-name}, e.g. 'notification-slack' (type 'notification', subtype 'slack').
  2. Place plugins in the configured plugin directory with the canonical name used by upstream CrowdSec plugin releases.
  3. If it's a custom plugin, rebuild/rename the output binary so its file name matches the plugin type-name convention.

Example fix

// before
/etc/crowdsec/plugins/slack
// after
/etc/crowdsec/plugins/notification-slack
Defensive patterns

Strategy: validation

Validate before calling

func pluginFilenameValid(path string) bool {
	base := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))
	return strings.Contains(base, "-") && strings.SplitN(base, "-", 2)[0] != "" && strings.SplitN(base, "-", 2)[1] != ""
}

Prevention

When it happens

Trigger: Calling getPluginTypeAndSubtypeFromPath (directly or via plugin loading in NewPluginWatcher) with a path whose base name, after stripping the extension, contains no '-' character, e.g. '/etc/crowdsec/plugins/slack' or '/usr/bin/myplugin'.

Common situations: Downloading a plugin binary and renaming it to drop the 'notification-' prefix; placing a plugin compiled from a module name without dashes; symlinking plugins with shortened names; Windows deployments where the plugin was copied under a custom filename.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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