{"record":{"id":"c055caa3da15229b","repo":"apache/cassandra","slug":"s-must-be-greater-than-zero","errorCode":null,"errorMessage":"%s must be greater than zero","messagePattern":"(.+?) must be greater than zero","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java","lineNumber":257,"sourceCode":"    }\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            {\n                WeightedDc dc = WeightedDc.fromString(dcString, autoIdx++);\n                if (mutableDcs.containsKey(dc.name))\n                    throw cfe(\"Multiple entries for DC %s\", dc.name);\n","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java#L239-L275","documentation":"After successfully parsing the 'size' option as an integer, fromMap() validates it is at least 1. A size of zero or negative is rejected with a ConfigurationException, since a fast-path coordinator quorum must contain at least one replica.","triggerScenarios":"Calling fromMap() with {\"size\": \"0\"} or {\"size\": \"-5\"} — any integer less than 1.","commonSituations":"Disabling the fast path by setting size to 0 instead of omitting/unsetting the option; hand-editing configuration with a negative value.","solutions":["Set 'size' to a positive integer (>= 1)","If the fast path should be disabled, remove the 'size' key entirely rather than setting 0","Clamp generated/config-managed values to >= 1 before passing to fromMap()"],"exampleFix":"// before\nMap<String,String> opts = Map.of(\"size\", \"0\");\nParameterizedFastPathStrategy.fromMap(opts); // throws\n// after\nMap<String,String> opts = Map.of(\"size\", \"1\");\nParameterizedFastPathStrategy.fromMap(opts); // ok","handlingStrategy":"validation","validationCode":"int size = Integer.parseInt(map.get(\"size\"));\nif (size < 1)\n    throw new IllegalArgumentException(\"size must be >= 1, got: \" + size);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use 0 to 'disable' an option — omit the key instead","Clamp values from external sources to a sane minimum before applying configuration"],"tags":["configuration","validation","accord"],"backgroundTag":"value-out-of-range","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"}