KB Article #181645

Instance fails to start with the error "Notsuch a capture group"

Problem

When starting an API Gateway instance, it fails to start with the error "Notsuch a capture group"

Resolution

This error refers to the capture groups in the regexes in a TraceRedactor configured in the API Gateway's redaction config. It means that the capture group named in the redact attribute of the Regex within the TraceRedactor refers to a capture group that does not exist in the regex, making the redaction config invalid. Be aware that non-capturing groups like (?:pattern) are not counted when numbering the capture groups. To resolve this error, edit the redaction config so that it does not refer to capture groups that do not exist in the regex, then start the gateway again.


When testing, you may find it helpful to visit any of the Java regex testers that may be found by searching for "java regex tester" with your preferred search engine. Such pages can help you test matches without restarting your gateway, and most will show you what would be contained in each capturing group, which is very helpful for more complex regexes, where the numbering is not obvious.