{"record":{"id":"8a6fee7765494356","repo":"crowdsecurity/crowdsec","slug":"while-globbing-acquis-dir-w","errorCode":null,"errorMessage":"while globbing acquis_dir: %w","messagePattern":"while globbing acquis_dir: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/csconfig/crowdsec_service.go","lineNumber":74,"sourceCode":"\n\t\t_, err := os.Stat(c.AcquisitionFilePath)\n\n\t\tswitch {\n\t\tcase errors.Is(err, fs.ErrNotExist):\n\t\t\tlog.Debugf(\"acquisition_path: %s does not exist, skipping\", c.AcquisitionFilePath)\n\t\tcase err != nil:\n\t\t\treturn nil, fmt.Errorf(\"while checking acquisition_path: %w\", err)\n\t\tdefault:\n\t\t\tret = append(ret, c.AcquisitionFilePath)\n\t\t}\n\t}\n\n\t// XXX: TODO: set default AcquisitionDirPath\n\n\tif c.AcquisitionDirPath != \"\" {\n\t\tdirFiles, err := filepath.Glob(c.AcquisitionDirPath + \"/*.yaml\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"while globbing acquis_dir: %w\", err)\n\t\t}\n\n\t\tret = append(ret, dirFiles...)\n\n\t\tdirFiles, err = filepath.Glob(c.AcquisitionDirPath + \"/*.yml\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"while globbing acquis_dir: %w\", err)\n\t\t}\n\n\t\tret = append(ret, dirFiles...)\n\t}\n\n\tif c.AcquisitionDirPath == \"\" && c.AcquisitionFilePath == \"\" {\n\t\treturn nil, ErrNoAcquisitionDefined\n\t}\n\n\t// files in 'ret' are already absolute\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/csconfig/crowdsec_service.go#L56-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users paste a directory path containing stray '[' or ']' (brackets interpreted as character classes), or templating/config tooling injects unbalanced brackets into acquisition_dir.","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'"],"exampleFix":"// before\nacquisition_dir: /etc/crowdsec/acquis[.dir\n// after\nacquisition_dir: /etc/crowdsec/acquis\\.dir","handlingStrategy":"validation","validationCode":"for _, ch := range dirPath { if ch == '[' || ch == ']' { return fmt.Errorf(\"acquisition_dir %q contains glob metacharacters\", dirPath) } }","typeGuard":null,"tryCatchPattern":"files, err := cfg.CollectAcquisitionFiles(); if err != nil { log.Fatalf(\"acquisition collection failed: %v\", err) }","preventionTips":["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"],"tags":["config","glob","startup"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}