crowdsecurity/crowdsec · error
while configuring %s: %w
Error message
while configuring %s: %w
What it means
loadPlugins spawns each plugin binary, connects over gRPC, and sends its config via pluginClient.Configure(ctx, &protobufs.Config{Config: data}) where data is the env-expanded yaml. If the plugin rejects the config or the RPC fails, the plugin name and error are wrapped as "while configuring %s: %w". It means the plugin process itself (or the transport to it) refused the registration.
Source
Thrown at pkg/csplugin/broker.go:322
if err != nil {
return err
}
for _, pc := range pb.pluginConfigByName {
if pc.Type != pSubtype {
continue
}
data, err := yaml.Marshal(pc)
if err != nil {
return err
}
data = []byte(csstring.StrictExpand(string(data), os.LookupEnv))
_, err = pluginClient.Configure(ctx, &protobufs.Config{Config: data})
if err != nil {
return fmt.Errorf("while configuring %s: %w", pc.Name, err)
}
log.Infof("registered plugin %s", pc.Name)
pb.notificationPluginByName[pc.Name] = pluginClient
}
}
return pb.verifyPluginBinaryWithProfile()
}
func (pb *PluginBroker) loadNotificationPlugin(ctx context.Context, name string, binaryPath string) (protobufs.NotifierServer, error) {
handshake, err := getHandshake()
if err != nil {
return nil, err
}
log.Debugf("Executing plugin %s", binaryPath)View on GitHub (pinned to 909b515798)
Solutions
- Run the plugin binary manually with the config to see its own validation error.
- Verify all env vars referenced in the notification yaml are set in crowdsec's environment (StrictExpand fails on unset vars).
- Check that required config fields for the plugin type (api_key, webhook url, etc.) are present and valid.
- Rebuild/reinstall the plugin binary so its protobufs version matches crowdsec's.
Example fix
// before: unset env var in yaml
api_key: ${SLACK_API_KEY}
// after: export it for the crowdsec process
export SLACK_API_KEY=xoxb-... && systemctl restart crowdsec Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight: expand env vars used in notification yamls csstring.StrictExpand(data, os.LookupEnv) // run before Configure to catch unset vars early
Try / catch
resp, err := pluginClient.Configure(ctx, cfgProto)
if err != nil {
log.Errorf("plugin %s rejected config: %v; validate yaml and env vars", pc.Name, err)
return err
} Prevention
- Export all env vars referenced with ${VAR} in notification yamls for the crowdsec service (systemd EnvironmentFile).
- Test plugins manually by running the binary and feeding the same config.
- Keep plugin binaries and crowdsec versions in sync (upgrade together).
When it happens
Trigger: PluginBroker.Init -> loadPlugins: gRPC Configure call returns error — plugin process crashed/exited, plugin validates config and rejects it (bad API key, missing fields), env expansion (StrictExpand) produced invalid yaml, or socket/timeout issues.
Common situations: Notification plugin config contains an unset env var reference ($SLACK_WEBHOOK_URL unset) leading to invalid value; plugin rejects config because of missing required field; plugin binary incompatible with the protobufs API version; plugin panics on startup.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- timeout exceeded
- while getting process attributes: both plugin user and group
- loading config: %w
- loading plugin: %w
- plugin %q: config not found
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/2b48195caeff1a94.
Report an issue: GitHub.