{"record":{"id":"d95ed0f436a98af4","repo":"cilium/cilium","slug":"invalid-http-path-filter-w","errorCode":null,"errorMessage":"invalid http path filter: %w","messagePattern":"invalid http path filter: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubble/filters/http.go","lineNumber":191,"sourceCode":"\n\tif ff.GetHttpMethod() != nil {\n\t\tif !httpMatchCompatibleEventFilter(ff.GetEventType()) {\n\t\t\treturn nil, errors.New(\"filtering by http method requires \" +\n\t\t\t\t\"the event type filter to only match 'l7' events\")\n\t\t}\n\n\t\tfs = append(fs, filterByHTTPMethods(ff.GetHttpMethod()))\n\t}\n\n\tif ff.GetHttpPath() != nil {\n\t\tif !httpMatchCompatibleEventFilter(ff.GetEventType()) {\n\t\t\treturn nil, errors.New(\"filtering by http path requires \" +\n\t\t\t\t\"the event type filter to only match 'l7' events\")\n\t\t}\n\n\t\tpathf, err := filterByHTTPPaths(ff.GetHttpPath())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid http path filter: %w\", err)\n\t\t}\n\t\tfs = append(fs, pathf)\n\t}\n\n\tif ff.GetHttpUrl() != nil {\n\t\tif !httpMatchCompatibleEventFilter(ff.GetEventType()) {\n\t\t\treturn nil, errors.New(\"filtering by http url requires \" +\n\t\t\t\t\"the event type filter to only match 'l7' events\")\n\t\t}\n\n\t\tpathf, err := filterByHTTPUrls(ff.GetHttpUrl())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid http url filter: %w\", err)\n\t\t}\n\t\tfs = append(fs, pathf)\n\t}\n\n\tif ff.GetHttpHeader() != nil {","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/hubble/filters/http.go#L173-L209","documentation":"This error wraps a failure from filterByHTTPPaths when building a filter for FlowFilter.httpPath. It indicates the supplied HTTP path patterns could not be compiled, usually due to an invalid regular expression used as a path pattern. The underlying regex/parse error is chained with %w.","triggerScenarios":"OnBuildFilter called with FlowFilter.httpPath entries that are invalid regexes, e.g. '[/api/' or a pattern with an unmatched parenthesis.","commonSituations":"Users writing regex-style HTTP path filters with unbalanced brackets or quantifiers, or pasting shell glob patterns expecting regex semantics.","solutions":["Read the wrapped error to identify which path pattern is invalid and fix the regex (escape special characters, close groups/brackets).","Test each path pattern with Go's regexp.Compile before adding it to the filter.","Use literal paths without regex metacharacters when exact matching is intended."],"exampleFix":"// before\nflowFilter.HttpPath = []string{\"/api/(v1\"}\n// after\nflowFilter.HttpPath = []string{\"/api/v1/.*\"}","handlingStrategy":"validation","validationCode":"for _, p := range flowFilter.GetHttpPath() {\n    if _, err := regexp.Compile(p); err != nil {\n        return fmt.Errorf(\"http path pattern %q is not a valid regex: %w\", p, err)\n    }\n}","typeGuard":"func isCompileableRegex(s string) bool {\n    _, err := regexp.Compile(s)\n    return err == nil\n}","tryCatchPattern":"ffs, err := filterBuilder.Build(ctx, flowFilter)\nif err != nil && strings.Contains(err.Error(), \"invalid http path filter\") {\n    return fmt.Errorf(\"check httpPath regex patterns: %w\", err)\n}","preventionTips":["Pre-compile each path pattern with regexp.Compile before use.","Escape regex metacharacters in literal paths (regexp.QuoteMeta).","Keep a test suite of all configured path patterns."],"tags":["hubble","filters","http","regex"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}