crowdsecurity/crowdsec · error
no configuration paths provided
Error message
no configuration paths provided
What it means
NewConfig calls loadConfigurationPaths, which expects the config_paths section to have been decoded into Config.ConfigPaths. This error means ConfigPaths is nil — no 'config_paths' section was present (or was explicitly empty) in the configuration file. Without it CrowdSec cannot resolve where configs, data, hub and notifications live, so startup aborts.
Source
Thrown at pkg/csconfig/config_paths.go:21
import (
"errors"
"path/filepath"
)
type ConfigurationPaths struct {
ConfigDir string `yaml:"config_dir"`
DataDir string `yaml:"data_dir,omitempty"`
SimulationFilePath string `yaml:"simulation_path,omitempty"`
HubIndexFile string `yaml:"index_path,omitempty"` // path of the .index.json
HubDir string `yaml:"hub_dir,omitempty"`
PluginDir string `yaml:"plugin_dir,omitempty"`
NotificationDir string `yaml:"notification_dir,omitempty"`
PatternDir string `yaml:"pattern_dir,omitempty"`
}
func (c *Config) loadConfigurationPaths() error {
if c.ConfigPaths == nil {
return errors.New("no configuration paths provided")
}
if c.ConfigPaths.ConfigDir == "" {
c.ConfigPaths.ConfigDir = filepath.Dir(c.FilePath)
}
if c.ConfigPaths.DataDir == "" {
return errors.New("please provide a data directory with the 'data_dir' directive in the 'config_paths' section")
}
if c.ConfigPaths.HubDir == "" {
c.ConfigPaths.HubDir = filepath.Join(c.ConfigPaths.ConfigDir, "hub")
}
if c.ConfigPaths.HubIndexFile == "" {
c.ConfigPaths.HubIndexFile = filepath.Join(c.ConfigPaths.HubDir, ".index.json")
}
View on GitHub (pinned to 909b515798)
Solutions
- Add a 'config_paths:' section with at least config_dir and data_dir to the configuration file passed via -c
- If constructing Config in code, initialize cfg.ConfigPaths = &ConfigurationPaths{ConfigDir: ..., DataDir: ...} before calling NewConfig
- Copy a reference config (e.g. config/config.yaml in the repo or /etc/crowdsec/config.yaml) and adapt the paths
Example fix
// before (config.yaml)
api:
server:
enabled: true
// after (config.yaml)
config_paths:
config_dir: /etc/crowdsec
data_dir: /var/lib/crowdsec/data
api:
server:
enabled: true Defensive patterns
Strategy: validation
Validate before calling
if cfg.ConfigPaths == nil {
return fmt.Errorf("config file must contain a 'config_paths' section")
} Try / catch
if _, err := csconfig.NewConfig(configPath, false); err != nil {
if strings.Contains(err.Error(), "no configuration paths") {
log.Fatalf("config file %s is missing the config_paths section", configPath)
}
return err
} Prevention
- Start every config.yaml from the reference config in the repo, which includes config_paths
- Keep config_dir and data_dir defined together in config_paths
- Validate configs with `cscli config show` or a smoke run before deploying
When it happens
Trigger: Calling csconfig.NewConfig (or LoadConfigurationPaths) with a Config whose ConfigPaths field was never populated — typically the YAML file has no 'config_paths:' section, or the caller built a Config struct programmatically and left ConfigPaths nil.
Common situations: Hand-written minimal config.yaml missing the config_paths block; upgrading from a very old install whose config predates the config_paths section; test harnesses constructing Config{} directly without setting ConfigPaths.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- while parsing '%s': %w
- loading online client credentials: %w
- failed to load postovflw parser patterns: %w
- failed to load parser config: %w
- path must start with /
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/28166da694a6355d.
Report an issue: GitHub.