crowdsecurity/crowdsec · error
while globbing acquis_dir: %w
Error message
while globbing acquis_dir: %w
What it means
CollectAcquisitionFiles builds the list of acquisition YAML files. When an acquisition_dir is configured it globs '<dir>/*.yaml'; filepath.Glob only fails on malformed patterns (ErrBadPattern), so this wraps a pattern-syntax error, not a missing directory. It is raised during LoadCrowdsec at agent startup.
Source
Thrown at pkg/csconfig/crowdsec_service.go:74
_, err := os.Stat(c.AcquisitionFilePath)
switch {
case errors.Is(err, fs.ErrNotExist):
log.Debugf("acquisition_path: %s does not exist, skipping", c.AcquisitionFilePath)
case err != nil:
return nil, fmt.Errorf("while checking acquisition_path: %w", err)
default:
ret = append(ret, c.AcquisitionFilePath)
}
}
// XXX: TODO: set default AcquisitionDirPath
if c.AcquisitionDirPath != "" {
dirFiles, err := filepath.Glob(c.AcquisitionDirPath + "/*.yaml")
if err != nil {
return nil, fmt.Errorf("while globbing acquis_dir: %w", err)
}
ret = append(ret, dirFiles...)
dirFiles, err = filepath.Glob(c.AcquisitionDirPath + "/*.yml")
if err != nil {
return nil, fmt.Errorf("while globbing acquis_dir: %w", err)
}
ret = append(ret, dirFiles...)
}
if c.AcquisitionDirPath == "" && c.AcquisitionFilePath == "" {
return nil, ErrNoAcquisitionDefined
}
// files in 'ret' are already absolute
View on GitHub (pinned to 909b515798)
Solutions
- Check acquisition_dir in your config for unbalanced glob brackets ('[' without a matching ']') and escape or remove them
- Use filepath.Escape or rename the directory so it contains no glob metacharacters
- If the directory really has brackets in its name, escape them: acquisition_dir: '/etc/crowdsec/acquis\[.dir'
Example fix
// before acquisition_dir: /etc/crowdsec/acquis[.dir // after acquisition_dir: /etc/crowdsec/acquis\.dir
Defensive patterns
Strategy: validation
Validate before calling
for _, ch := range dirPath { if ch == '[' || ch == ']' { return fmt.Errorf("acquisition_dir %q contains glob metacharacters", dirPath) } } Try / catch
files, err := cfg.CollectAcquisitionFiles(); if err != nil { log.Fatalf("acquisition collection failed: %v", err) } Prevention
- Keep acquisition_dir free of '[', ']', '{', '}' characters
- Use absolute, plain paths in acquisition_dir
- Test globbing the path with `echo /path/*.yaml` in a shell before configuring
When it happens
Trigger: crowdsec config contains acquisition_dir containing glob metacharacters that form an invalid pattern, e.g. an unclosed '[' like '/etc/crowdsec/acquis[.dir' — only the '*.yaml' call (first glob) hits this line.
Common situations: Users paste a directory path containing stray '[' or ']' (brackets interpreted as character classes), or templating/config tooling injects unbalanced brackets into acquisition_dir.
Related errors
- no configuration paths provided
- compilation of '%s' context value failed: %w
- while parsing '%s': %w
- failed to compile profiles: %w
- failed to create PAPI client: %w
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/8a6fee7765494356.
Report an issue: GitHub.