crowdsecurity/crowdsec · error
webhook_path cannot be empty
Error message
webhook_path cannot be empty
What it means
The kubernetesaudit source serves audit events at a specific HTTP endpoint path; Configuration.Validate() requires WebhookPath to be non-empty so the server can register the handler route that the Kubernetes audit sink POSTs to.
Source
Thrown at pkg/acquisition/modules/kubernetesaudit/config.go:76
return err
}
s.config = cfg
return nil
}
func (c *Configuration) Validate() error {
if c.ListenAddr == "" {
return errors.New("listen_addr cannot be empty")
}
if c.ListenPort == 0 {
return errors.New("listen_port cannot be empty")
}
if c.WebhookPath == "" {
return errors.New("webhook_path cannot be empty")
}
if c.MaxBodySize != nil && *c.MaxBodySize <= 0 {
return errors.New("max_body_size must be positive")
}
return nil
}
func (c *Configuration) Normalize() {
if c.WebhookPath != "" && c.WebhookPath[0] != '/' {
c.WebhookPath = "/" + c.WebhookPath
}
}
func (s *Source) Configure(_ context.Context, config []byte, logger *log.Entry, metricsLevel metrics.AcquisitionMetricsLevel) error {
s.logger = loggerView on GitHub (pinned to 909b515798)
Solutions
- Set webhook_path in the acquisition YAML, e.g. webhook_path: /audit or /kubernetes-audit.
- Use the same path in the Kubernetes API server audit webhook backend configuration (path field of the webhook config).
- Keep max_body_size positive if set, to pass the remaining validation checks.
Example fix
// before (yaml) source: kubernetesaudit listen_addr: 0.0.0.0 listen_port: 8080 // after (yaml) source: kubernetesaudit listen_addr: 0.0.0.0 listen_port: 8080 webhook_path: /audit
Defensive patterns
Strategy: validation
Validate before calling
if cfg.WebhookPath == "" {
return fmt.Errorf("kubernetesaudit: webhook_path is required")
} Prevention
- Keep webhook_path identical to the `path` in the Kubernetes audit webhook backend config.
- Use a distinctive path (e.g. /kubernetes-audit) and secure the endpoint with TLS/mTLS.
- Validate the whole kubernetesaudit config (addr, port, path) as one unit before deploy.
When it happens
Trigger: Calling Validate() on a kubernetesaudit Configuration where WebhookPath is the empty string — a YAML config missing the `webhook_path:` key.
Common situations: Users set address/port but assume a default path exists; or a config fragment copied without the path key. The path must also match the `path` in the API server's webhook audit sink config.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- listen_addr cannot be empty
- listen_port cannot be empty
- selector must be set in kubernetes acquisition
- mtls is selected, but ca_cert is not provided
- invalid auth_type: must be one of basic_auth, headers, mtls
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/279467693e7e4d3e.
Report an issue: GitHub.