{"record":{"id":"f6004974d4862c32","repo":"apache/cassandra","slug":"input-does-not-match-legacy","errorCode":null,"errorMessage":"{input} does not match {LEGACY}","messagePattern":"(.+?) does not match (.+?)","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/paxos/ContentionStrategy.java","lineNumber":298,"sourceCode":"\n    private static String orElse(Supplier<String> get, String orElse)\n    {\n        String result = get.get();\n        return result != null ? result : orElse;\n    }\n\n    @VisibleForTesting\n    static LegacyWait parseLegacy(String spec, boolean isMin)\n    {\n        long defaultMaxMicros = getRpcTimeout(MICROSECONDS);\n        return parseLegacy(spec, 0, defaultMaxMicros, isMin ? 0 : defaultMaxMicros, LATENCIES);\n    }\n\n    public static LegacyWait parseLegacy(String input, long defaultMinMicros, long defaultMaxMicros, long onFailure, LatencySourceFactory latencies)\n    {\n        Matcher m = LEGACY.matcher(input);\n        if (!m.matches())\n            throw new IllegalArgumentException(input + \" does not match \" + LEGACY);\n\n        String maybeConst = m.group(\"const\");\n        if (maybeConst != null)\n        {\n            long v = parseInMicros(maybeConst);\n            return new LegacyWait(v, v, v, new Wait.Constant(v));\n        }\n\n        long min = parseInMicros(m.group(\"min\"), defaultMinMicros);\n        long max = parseInMicros(m.group(\"max\"), defaultMaxMicros);\n        return new LegacyWait(min, max, onFailure, TimeoutStrategy.parseWait(m.group(\"delegate\"), latencies));\n    }\n\n\n    private static class LegacyWait implements Wait\n    {\n        final long min, max, onFailure;\n        final Wait delegate;","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/paxos/ContentionStrategy.java#L280-L316","documentation":"The legacy paxos contention strategy string (e.g. from paxos_contention_wait_* settings) must match the LEGACY regex (a constant or min,max[,on-failure] wait specification in time units). parseLegacy throws this IllegalArgumentException when the configured string does not conform to that grammar.","triggerScenarios":"Setting paxos contention wait configuration (paxos_contention_wait_random, _min, _max style legacy strings) to a value that doesn't match the LEGACY pattern — e.g. missing units, wrong separators, or garbage like 'foo' instead of '10ms' or '1ms,10ms'.","commonSituations":"Typo in cassandra.yaml contention settings; using new-format syntax against a legacy parser; missing time unit (e.g. '100' instead of '100ms'); whitespace or comma/semicolon mixups.","solutions":["Correct the contention wait string to match the legacy format: a duration constant or 'min,max' range with valid time units (e.g. '1ms,10ms')","Validate the setting with a local regex/test before deploying cassandra.yaml","Revert to defaults by removing the custom contention setting","Restart the node after fixing the config"],"exampleFix":"// cassandra.yaml\n// before\npaxos_contention_wait: 100\n// after\npaxos_contention_wait: 1ms,10ms","handlingStrategy":"validation","validationCode":"Pattern LEGACY = Pattern.compile(\"...\"); // same grammar as ContentionStrategy.LEGACY\nif (!LEGACY.matcher(cfgValue).matches()) throw new IllegalArgumentException(\"paxos contention wait string invalid: \" + cfgValue);","typeGuard":null,"tryCatchPattern":"try { LegacyWait w = LegacyWait.parseLegacy(value, ...); } catch (IllegalArgumentException e) { /* fix cassandra.yaml value, e.g. '1ms,10ms' */ }","preventionTips":["Always include time units in duration config values (e.g. 10ms, not 10)","Test new cassandra.yaml settings on one node before fleet rollout","Prefer the current (non-legacy) contention config format"],"tags":["paxos","config-parsing","invalid-format","contention"],"backgroundTag":"invalid-config-value","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"}