{"record":{"id":"f19b00381d0e3c78","repo":"caddyserver/caddy","slug":"compiling-regexp-pattern-d-s-v","errorCode":null,"errorMessage":"compiling regexp pattern %d (%s): %v","messagePattern":"compiling regexp pattern (.+?) \\((.+?)\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/logging/filters.go","lineNumber":925,"sourceCode":"\tif len(f.Operations) == 0 {\n\t\treturn fmt.Errorf(\"multi_regexp filter requires at least one operation\")\n\t}\n\n\tfor i := range f.Operations {\n\t\t// Security validation: pattern length check\n\t\tif len(f.Operations[i].RawRegexp) > maxPatternLength {\n\t\t\treturn fmt.Errorf(\"regexp pattern %d too long: %d characters (maximum %d)\", i, len(f.Operations[i].RawRegexp), maxPatternLength)\n\t\t}\n\n\t\t// Security validation: empty pattern check\n\t\tif f.Operations[i].RawRegexp == \"\" {\n\t\t\treturn fmt.Errorf(\"regexp pattern %d cannot be empty\", i)\n\t\t}\n\n\t\t// Compile and validate the pattern (uses RE2 engine - safe from ReDoS)\n\t\tr, err := regexp.Compile(f.Operations[i].RawRegexp)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"compiling regexp pattern %d (%s): %v\", i, f.Operations[i].RawRegexp, err)\n\t\t}\n\t\tf.Operations[i].regexp = r\n\t}\n\treturn nil\n}\n\n// Validate ensures the filter is properly configured with security checks.\nfunc (f *MultiRegexpFilter) Validate() error {\n\tif len(f.Operations) == 0 {\n\t\treturn fmt.Errorf(\"multi_regexp filter requires at least one operation\")\n\t}\n\n\tif len(f.Operations) > maxRegexpOperations {\n\t\treturn fmt.Errorf(\"too many regexp operations: %d (maximum %d allowed)\", len(f.Operations), maxRegexpOperations)\n\t}\n\n\tfor i, op := range f.Operations {\n\t\tif op.RawRegexp == \"\" {","sourceCodeStart":907,"sourceCodeEnd":943,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/logging/filters.go#L907-L943","documentation":"Error \"compiling regexp pattern %d (%s): %v\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/logging/filters.go:925 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the regexp pattern syntax at the given index; the wrapped error explains the compile failure."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}