{"record":{"id":"462c6fecb5a0fa7e","repo":"apache/cassandra","slug":"s-must-be-a-positive-number-got-s","errorCode":null,"errorMessage":"%s must be a positive number, got %s","messagePattern":"(.+?) must be a positive number, got (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java","lineNumber":253,"sourceCode":"\n    private static ConfigurationException cfe(String fmt, Object... args)\n    {\n        return new ConfigurationException(String.format(fmt, args));\n    }\n\n    public static ParameterizedFastPathStrategy fromMap(Map<String, String> map)\n    {\n        if (!map.containsKey(SIZE))\n            throw cfe(\"fast_path must be set to 'keyspace' or 'default' or a map defining '%s' and optionally '%s'\", SIZE, DCS);\n\n        int size;\n        try\n        {\n            size = Integer.parseInt(map.get(SIZE));\n        }\n        catch (NumberFormatException e)\n        {\n            throw cfe(\"%s must be a positive number, got %s\", SIZE, map.get(SIZE));\n        }\n\n        if (size < 1)\n            throw cfe(\"%s must be greater than zero\", SIZE);\n\n        ImmutableMap<String, WeightedDc> dcMap;\n        if (map.containsKey(DCS) && !map.get(DCS).isEmpty())\n        {\n            Map<String, WeightedDc> mutableDcs = new HashMap<>();\n            String dcsString = map.get(DCS);\n            if (dcsString.trim().isEmpty())\n                throw cfe(\"%s must specify at least one DC\", DCS);\n\n            int autoIdx = 0;\n            boolean hasAuto = false;\n            boolean hasManual = false;\n            for (String dcString : COMMA_SEPARATOR.split(dcsString))\n            {","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java#L235-L271","documentation":"ParameterizedFastPathStrategy.fromMap() parses the 'size' option from a string map of fast-path strategy options. If the value cannot be parsed as an integer (NumberFormatException), a ConfigurationException is thrown with this message. The 'positive number' wording means the value must be a valid positive integer.","triggerScenarios":"Calling ParameterizedFastPathStrategy.fromMap() with a map whose 'size' entry is not parseable by Integer.parseInt, e.g. \"size\" -> \"abc\", \"10.5\", \"\", or \"100ms\".","commonSituations":"Typing a decimal or unit-suffixed value in cassandra.yaml / nodetool fast-path configuration; copy-pasting strategy options with stray whitespace or locale-formatted numbers.","solutions":["Set the 'size' option to a plain positive integer string, e.g. {\"size\": \"100\"}","Remove unit suffixes or decimals (\"10.5\", \"100ms\") — only integers are accepted","Check for invisible whitespace or non-ASCII characters in the configured value"],"exampleFix":"// before\nMap<String,String> opts = Map.of(\"size\", \"10.5\");\nParameterizedFastPathStrategy.fromMap(opts); // throws\n// after\nMap<String,String> opts = Map.of(\"size\", \"10\");\nParameterizedFastPathStrategy.fromMap(opts); // ok","handlingStrategy":"validation","validationCode":"String size = map.get(\"size\");\nif (size == null || !size.trim().matches(\"\\\\d+\"))\n    throw new IllegalArgumentException(\"size must be a positive integer, got: \" + size);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store strategy options as typed values, converting to string only at the boundary","Validate configuration at startup, before it reaches fromMap()"],"tags":["configuration","validation","accord"],"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-14T16:17:12.679Z"}