{"record":{"id":"90b238880335a91b","repo":"apache/cassandra","slug":"input-does-not-match-wait","errorCode":null,"errorMessage":"{input} does not match {WAIT}","messagePattern":"(.+?) does not match (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/TimeoutStrategy.java","lineNumber":362,"sourceCode":"        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\n        String maybeConst = m.group(\"const\");\n        if (maybeConst != null)\n        {\n            long v = parseInMicros(maybeConst);\n            return new Wait.Constant(v);\n        }\n\n        LatencySupplier supplier = parseLatencySupplier(m, latencies);\n        LatencyModifier modifier = parseLatencyModifier(input, m, modifiers);\n        if (modifier == null && supplier instanceof LatencySupplier.Constant)\n            return new Wait.Constant(((Constant) supplier).micros);\n        if (modifier == null)\n            modifier = modifiers.identity();\n        return new Wait.Modifying(supplier, modifier);\n    }\n\n    public static long parseInMicros(String input, long orElse)","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/TimeoutStrategy.java#L344-L380","documentation":"Thrown by TimeoutStrategy.parseWait when the wait-expression portion of a timeout spec fails to match the WAIT regex. The WAIT grammar accepts constant durations or latency-source expressions with optional modifiers.","triggerScenarios":"A wait clause inside a timeout strategy string that is neither a recognized constant duration nor a valid latency-source expression, e.g. 'latency*foo' or gibberish text.","commonSituations":"Referencing a latency source name that does not exist; malformed modifier attached to the wait; typos in documented spec strings.","solutions":["Check the input against the WAIT pattern included in the message.","Use a plain duration (e.g. '500ms') or a valid latency source name registered with the LatencySourceFactory.","Validate the modifier syntax attached to the wait expression ('*' or '^' followed by a number)."],"exampleFix":"// before\nWait w = TimeoutStrategy.parseWait(\"latency*xyz\", latencies); // no such latency source/modifier\n// after\nWait w = TimeoutStrategy.parseWait(\"latency*2\", latencies);","handlingStrategy":"validation","validationCode":"// Wait clause must be a duration or registered latency source (+ optional *N or ^N)\nif (!input.matches(\"(?:<duration>|(?:<latencySource>)(?:[*^][0-9.]+)?)\")) throw new IllegalArgumentException(\"invalid wait: \" + input);","typeGuard":null,"tryCatchPattern":"try { TimeoutStrategy.parseWait(input, latencies); }\ncatch (IllegalArgumentException e) { if (e.getMessage().contains(\"does not match\")) { /* correct wait expression */ } throw e; }","preventionTips":["Reference only latency sources registered with the LatencySourceFactory","Use plain durations as the simplest valid wait","Check modifier prefixes are '*' or '^'"],"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"}