{"record":{"id":"5a023a9e51b83f83","repo":"apache/pulsar","slug":"unknown-regeximplementation","errorCode":null,"errorMessage":"Unknown RegexImplementation: ","messagePattern":"Unknown RegexImplementation: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicsPatternFactory.java","lineNumber":100,"sourceCode":"        }\n        switch (implementation) {\n            case RE2J:\n                return new RE2JTopicsPattern(inputPattern, regexWithoutTopicDomainScheme);\n            case JDK:\n                return new JDKTopicsPattern(inputPattern, regexWithoutTopicDomainScheme);\n            case RE2J_WITH_JDK_FALLBACK:\n                try {\n                    return new RE2JTopicsPattern(inputPattern, regexWithoutTopicDomainScheme);\n                } catch (com.google.re2j.PatternSyntaxException e) {\n                    log.debug()\n                            .attr(\"pattern\", regexWithoutTopicDomainScheme)\n                            .exception(e)\n                            .log(\"Failed to compile regex pattern with RE2J, fallback to JDK\");\n                    // Fallback to JDK implementation if RE2J fails\n                    return new JDKTopicsPattern(inputPattern, regexWithoutTopicDomainScheme);\n                }\n            default:\n                throw new IllegalArgumentException(\"Unknown RegexImplementation: \" + implementation);\n        }\n    }\n}\n","sourceCodeStart":82,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicsPatternFactory.java#L82-L104","documentation":"Thrown by TopicsPatternFactory.internalCreate when the configured RegexImplementation enum value has no case in the factory switch. The factory only knows a fixed set of regex engine implementations (RE2J, JDK); anything else is rejected as an unknown implementation.","triggerScenarios":"Calling TopicsPatternFactory.create with a RegexImplementation value that internalCreate does not handle — typically after a new enum constant is added (or a custom/unknown value is passed) without updating the switch statement.","commonSituations":"Broker/client config specifying a regex implementation unsupported by the running Pulsar version (config from a newer or older release); a downstream fork adding an enum constant without extending the factory; typos or stale configuration migration producing an unmatched value.","solutions":["Use a supported RegexImplementation value (JDK or RE2J) in the configuration","Align the Pulsar client/broker versions so the configured implementation exists in the running build","If extending, add a case for the new RegexImplementation in internalCreate with its TopicsPattern implementation","Search configuration files for stale regexImplementation values after upgrades"],"exampleFix":"// before\nTopicsPatternFactory.create(topic, RegexImplementation.Auto, ...) // enum value without a switch case\n// after\nTopicsPatternFactory.create(topic, RegexImplementation.RE2J, ...)","handlingStrategy":"validation","validationCode":"if (implementation != RegexImplementation.JDK && implementation != RegexImplementation.RE2J) {\n    throw new IllegalArgumentException(\"unsupported RegexImplementation: \" + implementation);\n}","typeGuard":null,"tryCatchPattern":"try {\n    pattern = TopicsPatternFactory.create(topic, impl, ...);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Unknown regex impl {}, falling back to JDK\", impl);\n    pattern = TopicsPatternFactory.create(topic, RegexImplementation.JDK, ...);\n}","preventionTips":["Use only enum constants present in your Pulsar version's RegexImplementation","Keep client and broker versions aligned when regexImplementation is configured","Update the factory switch whenever the enum gains new constants (in forks)","Default to RE2J or JDK rather than custom/uncommon values"],"tags":["regex","configuration","enum","factory"],"backgroundTag":"unknown-enum-value","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}