{"record":{"id":"a9e8838bb4ce5807","repo":"apache/cassandra","slug":"s-is-not-a-parsable-int-base10-for-s-a9e883","errorCode":null,"errorMessage":"%s is not a parsable int (base10) for %s","messagePattern":"(.+?) is not a parsable int \\(base10\\) for (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/unified/Controller.java","lineNumber":508,"sourceCode":"\n        s = options.remove(SCALING_PARAMETERS_OPTION);\n        if (s != null)\n            parseScalingParameters(s);\n\n        s = options.remove(BASE_SHARD_COUNT_OPTION);\n        if (s != null)\n        {\n            try\n            {\n                int numShards = Integer.parseInt(s);\n                if (numShards <= 0)\n                    throw new ConfigurationException(String.format(\"Invalid configuration, %s should be positive: %d\",\n                                                                   BASE_SHARD_COUNT_OPTION,\n                                                                   numShards));\n            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\",\n                                                               s,\n                                                               BASE_SHARD_COUNT_OPTION), e);\n            }\n        }\n\n        // preserve the configuration for later use during min_sstable_size.\n        long targetSSTableSize = DEFAULT_TARGET_SSTABLE_SIZE;\n        s = options.remove(TARGET_SSTABLE_SIZE_OPTION);\n        if (s != null)\n        {\n            try\n            {\n                double targetSize = FBUtilities.parseHumanReadable(s, null, \"B\");\n                if (targetSize >= Long.MAX_VALUE) {\n                    throw new ConfigurationException(String.format(\"%s %s is out of range of Long.\",\n                                                                    TARGET_SSTABLE_SIZE_OPTION,\n                                                                    s));\n                }","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/unified/Controller.java#L490-L526","documentation":"The NumberFormatException catch branch for base_shard_count in Controller.validateOptions: when the option value is not a base-10 parsable int, ConfigurationException is thrown with the raw string and the option name, chained to the parse exception.","triggerScenarios":"validateOptions with base_shard_count set to 'four', '4.0', '', ' 4', or a value above Integer.MAX_VALUE.","commonSituations":"Decimal values from JSON templating; accidental units ('4 shards'); whitespace or quotes leaking into the value; large numbers exceeding int range.","solutions":["Set base_shard_count to a plain base-10 integer string, e.g. '4'","Sanitize generated configs to emit integers without decimals/units/whitespace","Remove the option to use the default","Catch ConfigurationException around schema changes for clear feedback"],"exampleFix":"// before\n'base_shard_count': '4.0'\n// after\n'base_shard_count': '4'","handlingStrategy":"validation","validationCode":"if (opts.containsKey(\"base_shard_count\") && !opts.get(\"base_shard_count\").trim().matches(\"\\\\d+\"))\n    throw new IllegalArgumentException(\"base_shard_count must be a plain base-10 integer\");","typeGuard":"static boolean isInt(String s) { if (s == null) return false; try { Integer.parseInt(s.trim()); return true; } catch (NumberFormatException e) { return false; } }","tryCatchPattern":"try {\n    session.execute(alterStmt);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"is not a parsable int\") && e.getMessage().contains(\"base_shard_count\")) { /* fix value */ }\n    throw e;\n}","preventionTips":["Emit integers, not decimals, when templating options (4 not 4.0)","Avoid unit suffixes on numeric compaction options","Trim whitespace and strip surrounding quotes before applying"],"tags":["cassandra","configuration","compaction","ucs","numberformat"],"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"}