{"record":{"id":"bc105a67cc30647a","repo":"apache/cassandra","slug":"fast-path-must-be-set-to-keyspace-or-default-o","errorCode":null,"errorMessage":"fast_path must be set to 'keyspace' or 'default' or a map defining '%s' and optionally '%s'","messagePattern":"fast_path must be set to 'keyspace' or 'default' or a map defining '(.+?)' and optionally '(.+?)'","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java","lineNumber":244,"sourceCode":"        Node.Id[] array = new Node.Id[fpSize];\n        for (int i=0; i<fpSize; i++)\n            array[i] = sorters.get(i).id;\n\n        Arrays.sort(array);\n        SortedArrayList<Node.Id> electorate = new SortedArrayList<>(array);\n        Invariants.require(electorate.size() >= slowQuorum);\n        return electorate;\n    }\n\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<>();","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java#L226-L262","documentation":"ParameterizedFastPathStrategy.fromMap throws a ConfigurationException when the fast_path option is a map but lacks the required 'size' key. A map-valued fast_path must define 'size' and optionally 'dcs'; without 'size' the strategy cannot be constructed, and the message states the accepted forms ('keyspace', 'default', or such a map).","triggerScenarios":"Setting a keyspace/table fast_path option to a map that contains only 'dcs' (or other keys) without 'size', e.g. {fast_path: {'dcs':'dc1'}}.","commonSituations":"Typo'd key ('sizes', 'Size') instead of 'size'; operator assuming dcs alone suffices; copying a partial example; camelCasing when serializing options through a tool that alters keys.","solutions":["Add the required size key with a positive integer, e.g. {fast_path: {'size':'4', 'dcs':'dc1:1'}}","Check for key spelling/case errors ('size' exactly)","If no parameterization is needed, use the string forms fast_path='keyspace' or fast_path='default' instead of a map"],"exampleFix":"// before\nALTER KEYSPACE ks WITH options = {fast_path: {'dcs':'dc1:1'}}\n\n// after\nALTER KEYSPACE ks WITH options = {fast_path: {'size':'4', 'dcs':'dc1:1'}}","handlingStrategy":"validation","validationCode":"if (!map.containsKey(\"size\"))\n    throw new IllegalArgumentException(\"fast_path map requires 'size'; got keys: \" + map.keySet());\nInteger.parseInt(map.get(\"size\")); // also fail fast on non-numeric size","typeGuard":null,"tryCatchPattern":"try { applyFastPathOption(opts); } catch (org.apache.cassandra.exceptions.ConfigurationException e) {\n    if (e.getMessage().contains(\"fast_path must be set\"))\n        log.error(\"Map-valued fast_path must define 'size' (and optionally 'dcs')\");\n}","preventionTips":["Always build fast_path maps from a helper that requires size","Check key spelling/case ('size' exactly)","Use the plain string forms 'keyspace'/'default' when no parameterization is needed","Copy from documented examples rather than partial snippets"],"tags":["cassandra","accord","configuration","missing-key"],"backgroundTag":"missing-required-config-field","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"}