{"record":{"id":"e9838a978d8805a6","repo":"apache/cassandra","slug":"invalid-modifier-specification-unrecognised-prope","errorCode":null,"errorMessage":"Invalid modifier specification: unrecognised property '${key}'","messagePattern":"Invalid modifier specification: unrecognised property '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/RetryStrategy.java","lineNumber":280,"sourceCode":"    }\n\n    public static RetryStrategy parse(String spec, LatencySourceFactory latencies, WaitRandomizer randomizer)\n    {\n        String original = spec;\n        int retries = Integer.MAX_VALUE;\n        int end = spec.length();\n        {\n            int next;\n            while ((next = spec.lastIndexOf(',', end - 1)) >= 0)\n            {\n                int mid = spec.indexOf('=', next + 1);\n                if (mid <= next || mid >= end)\n                    throw new IllegalArgumentException(\"Invalid modifier specification: '\" + spec.substring(next, end) + \"'; expecting '=' for value assignment\");\n                String key = spec.substring(next + 1, mid).trim();\n                String value = spec.substring(mid + 1, end).trim();\n                switch (key)\n                {\n                    default: throw new IllegalArgumentException(\"Invalid modifier specification: unrecognised property '\" + key + '\\'');\n                    case \"retries\":\n                        retries = Integer.parseInt(value);\n                        if (retries < 0)\n                            throw new IllegalArgumentException(\"retries must be non-negative (retries=\" + value + \" supplied)\");\n                        break;\n                    case \"attempts\":\n                        retries = Integer.parseInt(value);\n                        if (retries < 0)\n                            throw new IllegalArgumentException(\"Must permit at least one attempt (attempts=\" + value + \" supplied)\");\n                        break;\n                    case \"rnd\":\n                        if (randomizer != null)\n                            throw new IllegalArgumentException(\"Randomizer already specified, cannot re-specify: \" + value);\n                        randomizer = parseWaitRandomizer(value);\n                        break;\n                }\n                end = next;\n            }","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/RetryStrategy.java#L262-L298","documentation":"RetryStrategy.parse() accepts comma-separated trailing modifiers of the form key=value (retries, attempts, rnd). If the key before '=' in a modifier is not one of these, an IllegalArgumentException is thrown with the offending key name. The library throws early so that an invalid retry policy spec never silently produces a strategy with ignored settings.","triggerScenarios":"Calling RetryStrategy.parse(spec, latencies) where a trailing ',<key>=<value>' modifier uses an unknown key, e.g. \"100ms,retry=5\" or \"500ms,maattempt=3\" (typo). The modifier parser splits on the last ',' and expects key in {retries, attempts, rnd}.","commonSituations":"Typos in cassandra.yaml or programmatically built retry specs; copying spec syntax from another library with different modifier names (e.g. 'maxRetries' instead of 'retries'); config drift after a version change renaming accepted keys.","solutions":["Rename the modifier key to one of the supported values: retries, attempts, or rnd","Check for typos in the key name (e.g. 'retry' -> 'retries')","If using 'maxRetries'-style keys, convert to 'retries=<n>' syntax","Verify the full spec string has no stray segments after the wait definition that look like modifiers"],"exampleFix":"// before\nRetryStrategy.parse(\"100ms,maxRetries=5\", latencies);\n// after\nRetryStrategy.parse(\"100ms,retries=5\", latencies);","handlingStrategy":"validation","validationCode":"private static final Set<String> ALLOWED_KEYS = Set.of(\"retries\", \"attempts\", \"rnd\");\nstatic void validateModifiers(String spec) {\n    String[] parts = spec.split(\",\");\n    for (int i = 1; i < parts.length; i++) {\n        int eq = parts[i].indexOf('=');\n        if (eq < 0) throw new IllegalArgumentException(\"Modifier '\" + parts[i] + \"' needs '='\");\n        String key = parts[i].substring(0, eq).trim();\n        if (!ALLOWED_KEYS.contains(key))\n            throw new IllegalArgumentException(\"Unknown modifier key: \" + key);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    RetryStrategy strategy = RetryStrategy.parse(spec, latencies);\n} catch (IllegalArgumentException e) {\n    LOG.error(\"Invalid retry spec '{}': {}\", spec, e.getMessage());\n    throw new ConfigurationException(\"Bad retry strategy spec: \" + spec, e);\n}","preventionTips":["Only use retries, attempts, or rnd as modifier keys","Validate specs at config-load time, not at first request time","Keep retry specs in one shared constant/builder instead of inline strings"],"tags":["configuration","parsing","illegal-argument"],"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"}