{"record":{"id":"8dce1c1abb199a57","repo":"apache/cassandra","slug":"maximum-number-of-connections-s-is-not-a-valid-in","errorCode":null,"errorMessage":"Maximum number of connections %s is not a valid integer for index %s","messagePattern":"Maximum number of connections (.+?) is not a valid integer for index (.+?)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sai/disk/v1/IndexWriterConfig.java","lineNumber":131,"sourceCode":"            options.get(CONSTRUCTION_BEAM_WIDTH) != null ||\n            options.get(SIMILARITY_FUNCTION) != null ||\n            options.get(OPTIMIZE_FOR) != null)\n        {\n            if (!indexTermType.isVector())\n                throw new InvalidRequestException(String.format(\"CQL type %s cannot have vector options\", indexTermType.asCQL3Type()));\n\n            if (options.containsKey(MAXIMUM_NODE_CONNECTIONS))\n            {\n                if (!CassandraRelevantProperties.SAI_VECTOR_ALLOW_CUSTOM_PARAMETERS.getBoolean())\n                    throw new InvalidRequestException(String.format(\"Maximum node connections cannot be set without enabling %s\", CassandraRelevantProperties.SAI_VECTOR_ALLOW_CUSTOM_PARAMETERS.name()));\n\n                try\n                {\n                    maximumNodeConnections = Integer.parseInt(options.get(MAXIMUM_NODE_CONNECTIONS));\n                }\n                catch (NumberFormatException e)\n                {\n                    throw new InvalidRequestException(String.format(\"Maximum number of connections %s is not a valid integer for index %s\",\n                                                                    options.get(MAXIMUM_NODE_CONNECTIONS), indexName));\n                }\n                if (maximumNodeConnections <= 0 || maximumNodeConnections > MAXIMUM_MAXIMUM_NODE_CONNECTIONS)\n                    throw new InvalidRequestException(String.format(\"Maximum number of connections for index %s cannot be <= 0 or > %s, was %s\", indexName, MAXIMUM_MAXIMUM_NODE_CONNECTIONS, maximumNodeConnections));\n            }\n            if (options.containsKey(CONSTRUCTION_BEAM_WIDTH))\n            {\n                if (!CassandraRelevantProperties.SAI_VECTOR_ALLOW_CUSTOM_PARAMETERS.getBoolean())\n                    throw new InvalidRequestException(String.format(\"Construction beam width cannot be set without enabling %s\", CassandraRelevantProperties.SAI_VECTOR_ALLOW_CUSTOM_PARAMETERS.name()));\n\n                try\n                {\n                    queueSize = Integer.parseInt(options.get(CONSTRUCTION_BEAM_WIDTH));\n                }\n                catch (NumberFormatException e)\n                {\n                    throw new InvalidRequestException(String.format(\"Construction beam width %s is not a valid integer for index %s\",\n                                                                    options.get(CONSTRUCTION_BEAM_WIDTH), indexName));","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/disk/v1/IndexWriterConfig.java#L113-L149","documentation":"Thrown by IndexWriterConfig.fromOptions when the value of 'maximum_node_connections' cannot be parsed as an integer. The option must be a plain integer string; anything else (letters, decimals, whitespace-only) fails Integer.parseInt.","triggerScenarios":"CREATE CUSTOM INDEX on a vector column WITH OPTIONS = {'maximum_node_connections': 'thirty-two'} or '32.0' or ' 32' (unparseable by Integer.parseInt).","commonSituations":"Quoting/decimal mistakes; passing a float-formatted number; locale or whitespace artifacts from generated CQL; user thinking the value is a percentage.","solutions":["Provide a plain integer string, e.g. 'maximum_node_connections': '32'","Remove any decimal point, units, or non-digit characters","Trim whitespace from the value","Validate with Integer.parseInt (or a regex ^-?\\d+$) before issuing the CQL"],"exampleFix":"// before\nWITH OPTIONS = {'maximum_node_connections': '32.0'}\n// after\nWITH OPTIONS = {'maximum_node_connections': '32'}","handlingStrategy":"validation","validationCode":"String v = opts.get(\"maximum_node_connections\");\nif (v != null) Integer.parseInt(v.trim()); // throws NumberFormatException before the DDL if invalid","typeGuard":null,"tryCatchPattern":"try { session.execute(createIndexCql); }\ncatch (InvalidRequestException e) {\n    if (e.getMessage().contains(\"is not a valid integer\")) { /* coerce/fix the option value */ }\n    else throw e;\n}","preventionTips":["Always render integer options with String.valueOf(int)","Reject non-integer input at the config/tooling layer","Trim and normalize option values before CQL generation"],"tags":["cassandra","sai","vector-index","number-format","index-options"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}