{"record":{"id":"a5f8e4b3e6101ff8","repo":"apache/cassandra","slug":"construction-beam-width-s-is-not-a-valid-integer","errorCode":null,"errorMessage":"Construction beam width %s is not a valid integer for index %s","messagePattern":"Construction beam width (.+?) 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":148,"sourceCode":"                {\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));\n                }\n                if (queueSize <= 0 || queueSize > MAXIMUM_CONSTRUCTION_BEAM_WIDTH)\n                    throw new InvalidRequestException(String.format(\"Construction beam width for index %s cannot be <= 0 or > %s, was %s\", indexName, MAXIMUM_CONSTRUCTION_BEAM_WIDTH, queueSize));\n            }\n            if (options.containsKey(SIMILARITY_FUNCTION))\n            {\n                String option = toUpperCaseLocalized(options.get(SIMILARITY_FUNCTION));\n                try\n                {\n                    similarityFunction = VectorSimilarityFunction.valueOf(option);\n                }\n                catch (IllegalArgumentException e)\n                {\n                    throw new InvalidRequestException(String.format(\"Similarity function %s was not recognized for index %s. Valid values are: %s\",\n                                                                    option, indexName, validSimilarityFunctions));\n                }\n            }","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/disk/v1/IndexWriterConfig.java#L130-L166","documentation":"Fired in SAI IndexWriterConfig.fromOptions while parsing index CREATE/OPTIONS: the 'beam_width' option string cannot be parsed as an integer (NumberFormatException caught and rethrown as InvalidRequestException). This is a config-value validation guard for vector-index ANN search tuning, naming the bad value and the index.","triggerScenarios":"CREATE CUSTOM INDEX on a vector column WITH OPTIONS = {'construction_beam_width': 'wide'} or '200.5' or ' 200' — any non-integer string.","commonSituations":"Decimal or unit-suffixed values; whitespace from template interpolation; typos in generated CQL; confusion with memory-size strings like '200M'.","solutions":["Provide a plain integer string, e.g. 'construction_beam_width': '120'","Remove decimals, units, or stray characters","Trim whitespace around the value","Validate with Integer.parseInt before submitting the DDL"],"exampleFix":"// before\nWITH OPTIONS = {'construction_beam_width': '200.5'}\n// after\nWITH OPTIONS = {'construction_beam_width': '200'}","handlingStrategy":"validation","validationCode":"String v = opts.get(\"construction_beam_width\");\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(\"Construction beam width\") && e.getMessage().contains(\"not a valid integer\")) { /* fix value */ }\n    else throw e;\n}","preventionTips":["Emit integer options via String.valueOf(int)","Strip units/decimals from user input at the tooling layer","Trim whitespace from interpolated values"],"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"}