{"record":{"id":"a4f6c60efdf31b3b","repo":"apache/cassandra","slug":"s-validateoptions-threw-an-error-s-s","errorCode":null,"errorMessage":"%s.validateOptions() threw an error: %s %s","messagePattern":"(.+?)\\.validateOptions\\(\\) threw an error: (.+?) (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CompactionParams.java","lineNumber":219,"sourceCode":"                                                        unknownOptions.keySet(),\n                                                        klass.getSimpleName()));\n            }\n        }\n        catch (NoSuchMethodException e)\n        {\n            logger.warn(\"Compaction strategy {} does not have a static validateOptions method. Validation ignored\",\n                        klass.getName());\n        }\n        catch (InvocationTargetException e)\n        {\n            if (e.getTargetException() instanceof ConfigurationException)\n                throw (ConfigurationException) e.getTargetException();\n\n            Throwable cause = e.getCause() == null\n                            ? e\n                            : e.getCause();\n\n            throw new ConfigurationException(format(\"%s.validateOptions() threw an error: %s %s\",\n                                                    klass.getName(),\n                                                    cause.getClass().getName(),\n                                                    cause.getMessage()),\n                                             e);\n        }\n        catch (IllegalAccessException e)\n        {\n            throw new ConfigurationException(\"Cannot access method validateOptions in \" + klass.getName(), e);\n        }\n\n        String minThreshold = options.get(Option.MIN_THRESHOLD.toString());\n        if (minThreshold != null && !StringUtils.isNumeric(minThreshold))\n        {\n            throw new ConfigurationException(format(\"Invalid value %s for '%s' compaction sub-option - must be an integer\",\n                                                    minThreshold,\n                                                    Option.MIN_THRESHOLD));\n        }\n","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CompactionParams.java#L201-L237","documentation":"CompactionParams.validate() wraps any unexpected Throwable thrown by the strategy's reflective validateOptions() call into a ConfigurationException stating that <class>.validateOptions() threw an error, including the cause's class name and message. It signals a bug or unhandled condition inside the compaction strategy class itself, not merely a bad option key.","triggerScenarios":"Calling ALTER TABLE ... WITH compaction = {'class':'...', ...} where the strategy's static validateOptions(Map) throws at runtime — e.g. NumberFormatException parsing a numeric option like min/max_threshold, or NPE on a null option value.","commonSituations":"Passing non-integer values for min_threshold/max_threshold; null values in the compaction map; strategy classes with version-specific bugs (e.g. older TWCS validating window options defensively).","solutions":["Read the cause class/message embedded in the error (e.g. NumberFormatException: For input string: \"abc\") and fix the offending option value.","Ensure numeric sub-options like min_threshold/max_threshold are valid integers.","Null-check option values in config tooling before applying the ALTER.","If the crash is a strategy bug, upgrade to a Cassandra version with the fix or file a JIRA."],"exampleFix":"// before\nALTER TABLE t WITH compaction = {'class':'SizeTieredCompactionStrategy','min_threshold':'four'};\n// after\nALTER TABLE t WITH compaction = {'class':'SizeTieredCompactionStrategy','min_threshold':'4'};","handlingStrategy":"try-catch","validationCode":"opts.forEach((k, v) -> { if (v == null) throw new IllegalArgumentException(\"null value for \" + k); });","typeGuard":null,"tryCatchPattern":"try { applyCompaction(opts); } catch (ConfigurationException e) {\n    logger.error(\"validateOptions failed: {}\", e.getMessage(), e);\n    // inspect cause class (e.g. NumberFormatException) and fix the option value\n}","preventionTips":["Pass valid integers for min_threshold/max_threshold.","Never send null values in the compaction map.","Pin Cassandra versions with known-fixed strategy validation bugs."],"tags":["cassandra","configuration","compaction","reflection"],"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"}