{"record":{"id":"247cb3c9c0fbf0f8","repo":"crowdsecurity/crowdsec","slug":"container-id-regexp-w","errorCode":null,"errorMessage":"container_id_regexp: %w","messagePattern":"container_id_regexp: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/config.go","lineNumber":104,"sourceCode":"\t}\n\n\tif d.Config.Mode != configuration.CAT_MODE && d.Config.Mode != configuration.TAIL_MODE {\n\t\treturn fmt.Errorf(\"unsupported mode %s for docker datasource\", d.Config.Mode)\n\t}\n\n\tfor _, cont := range d.Config.ContainerNameRegexp {\n\t\tcompiled, err := regexp.Compile(cont)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"container_name_regexp: %w\", err)\n\t\t}\n\n\t\td.compiledContainerName = append(d.compiledContainerName, compiled)\n\t}\n\n\tfor _, cont := range d.Config.ContainerIDRegexp {\n\t\tcompiled, err := regexp.Compile(cont)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"container_id_regexp: %w\", err)\n\t\t}\n\n\t\td.compiledContainerID = append(d.compiledContainerID, compiled)\n\t}\n\n\tfor _, svc := range d.Config.ServiceNameRegexp {\n\t\tcompiled, err := regexp.Compile(svc)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"service_name_regexp: %w\", err)\n\t\t}\n\n\t\td.compiledServiceName = append(d.compiledServiceName, compiled)\n\t}\n\n\tfor _, svc := range d.Config.ServiceIDRegexp {\n\t\tcompiled, err := regexp.Compile(svc)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"service_id_regexp: %w\", err)","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/config.go#L86-L122","documentation":"The docker acquisition source compiles every entry of the `container_id_regexp` configuration list into Go regular expressions during UnmarshalConfig. If regexp.Compile fails for any entry, the error is wrapped with this prefix and configuration is aborted. It means one of the container_id_regexp values is not a syntactically valid RE2 regular expression.","triggerScenarios":"Calling Configure/UnmarshalConfig on the docker source while d.Config.ContainerIDRegexp contains a string that Go's regexp.Compile rejects (unbalanced parens, bad quantifiers like `*` at start, invalid escapes, stray `[`).","commonSituations":"Hand-edited acquis.yaml DSN or YAML config with a typo in the regex; copying PCRE-only syntax (lookaheads, backreferences) unsupported by Go's RE2 engine; unescaped special characters in a container ID prefix.","solutions":["Validate the regex syntax and fix it (test with regexp.Compile or an RE2 playground).","Remove PCRE-only constructs (lookahead/lookbehind, backreferences) — Go regexp does not support them.","Escape literal special characters (e.g. `.` -> `\\.`) in the pattern.","If a plain container ID is intended, use the `container_id` config key instead of a regexp."],"exampleFix":"// before\ncontainer_id_regexp:\n  - ^a(b?c$   # unbalanced group\n// after\ncontainer_id_regexp:\n  - ^a(bc)?$","handlingStrategy":"validation","validationCode":"for _, re := range cfg.ContainerIDRegexp {\n    if _, err := regexp.Compile(re); err != nil {\n        return fmt.Errorf(\"invalid container_id_regexp %q: %w\", re, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Unit-test every regex in your acquis config with regexp.Compile before deploying.","Avoid PCRE-only syntax; Go uses RE2.","Prefer exact container_id/container_name lists when regex is unnecessary."],"tags":["regex","config","docker"],"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"}