{"record":{"id":"cccdba3060ee20e2","repo":"apache/cassandra","slug":"invalid-specification-input-does-not-match","errorCode":null,"errorMessage":"Invalid specification: '{input}'; does not match {PARSE}","messagePattern":"Invalid specification: '(.+?)'; does not match (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/TimeoutStrategy.java","lineNumber":345,"sourceCode":"            return modifiers.multiplyByAttempts(modifier);\n        else if (modkind.startsWith(\"^\"))\n            return modifiers.multiplyByAttemptsExp(modifier);\n        else\n            throw new IllegalArgumentException(\"Unrecognised attempt modifier: \" + modkind);\n    }\n\n    static long saturatedCast(double v)\n    {\n        if (v > Long.MAX_VALUE)\n            return Long.MAX_VALUE;\n        return (long) v;\n    }\n\n    public static TimeoutStrategy parse(String input, LatencySourceFactory latencies)\n    {\n        Matcher m = PARSE.matcher(input);\n        if (!m.matches())\n            throw new IllegalArgumentException(\"Invalid specification: '\" + input + \"'; does not match \" + PARSE);\n        long min = parseInMicros(m.group(\"min\"), 0);\n        long max = parseInMicros(m.group(\"max\"), Long.MAX_VALUE);\n        Wait wait = TimeoutStrategy.parseWait(m.group(\"wait\"), latencies);\n        return new TimeoutStrategy(wait, min, max);\n    }\n\n    public static Wait parseWait(String input, LatencySourceFactory latencies)\n    {\n        return parseWait(input, latencies, modifiers);\n    }\n\n    @VisibleForTesting\n    static Wait parseWait(String input, LatencySourceFactory latencies, LatencyModifierFactory modifiers)\n    {\n        Matcher m = WAIT.matcher(input);\n        if (!m.matches())\n            throw new IllegalArgumentException(input + \" does not match \" + WAIT);\n","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/TimeoutStrategy.java#L327-L363","documentation":"Thrown by TimeoutStrategy.parse when the whole input string does not match the PARSE regular expression that defines valid timeout strategy specifications. The message includes both the input and the expected pattern.","triggerScenarios":"Passing a malformed strategy string to parse() (used for configurable timeouts), e.g. missing the wait clause, stray characters, or wrong ordering of min/max/wait parts.","commonSituations":"Typing timeout expressions by hand in cassandra.yaml or system properties; whitespace or punctuation errors; confusing timeout strategy syntax with plain duration strings.","solutions":["Match the input against the PARSE pattern printed in the message and fix the syntax.","Use the documented form, e.g. 'min..max for <wait expression>' structure expected by the regex.","Simplify to a constant timeout spec and build up complexity until it parses."],"exampleFix":"// before\nTimeoutStrategy.parse(\"100ms\", latencies); // missing required structure\n// after\nTimeoutStrategy.parse(\"0..1s for fixed(100ms)\", latencies);","handlingStrategy":"validation","validationCode":"java.util.regex.Pattern PARSE = java.util.regex.Pattern.compile(\"<the documented strategy grammar>\");\nif (!PARSE.matcher(input).matches()) throw new IllegalArgumentException(\"invalid timeout spec: \" + input);","typeGuard":null,"tryCatchPattern":"try { TimeoutStrategy.parse(input, latencies); }\ncatch (IllegalArgumentException e) { if (e.getMessage().contains(\"Invalid specification\")) { /* fix syntax per printed pattern */ } throw e; }","preventionTips":["Validate the full spec string against the PARSE regex before configuring","Start from documented example specs","Avoid manual edits with unbalanced punctuation or whitespace"],"tags":["cassandra","configuration","timeout","parse-error","regex"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}