{"record":{"id":"5efa502f1710a644","repo":"oracle/graal","slug":"non-empty-value-required-for-option-s","errorCode":null,"errorMessage":"Non empty value required for option '%s'","messagePattern":"Non empty value required for option '(.+?)'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.options/src/jdk/graal/compiler/options/OptionsParser.java","lineNumber":248,"sourceCode":"            value = uncheckedValue;\n        } else {\n            if (optionType == Boolean.class) {\n                if (\"true\".equals(valueString)) {\n                    value = Boolean.TRUE;\n                } else if (\"false\".equals(valueString)) {\n                    value = Boolean.FALSE;\n                } else {\n                    throw new IllegalArgumentException(\"Boolean option '\" + desc.getName() + \"' must have value \\\"true\\\" or \\\"false\\\", not \\\"\" + uncheckedValue + \"\\\"\");\n                }\n            } else if (optionType == String.class) {\n                value = valueString;\n            } else if (Enum.class.isAssignableFrom(optionType)) {\n                value = ((EnumOptionKey<?>) desc.getOptionKey()).valueOf(valueString);\n            } else if (optionType == EconomicSet.class) {\n                value = ((EnumMultiOptionKey<?>) desc.getOptionKey()).valueOf(valueString);\n            } else {\n                if (valueString.isEmpty()) {\n                    throw new IllegalArgumentException(\"Non empty value required for option '\" + desc.getName() + \"'\");\n                }\n                try {\n                    if (optionType == Float.class) {\n                        value = Float.parseFloat(valueString);\n                    } else if (optionType == Double.class) {\n                        value = Double.parseDouble(valueString);\n                    } else if (optionType == Integer.class) {\n                        value = (int) parseLong(valueString);\n                    } else if (optionType == Long.class) {\n                        value = parseLong(valueString);\n                    } else {\n                        throw new IllegalArgumentException(\"Wrong value for option '\" + desc.getName() + \"'\");\n                    }\n                } catch (NumberFormatException nfe) {\n                    throw new IllegalArgumentException(\"Value for option '\" + desc.getName() + \"' has invalid number format: \" + valueString);\n                }\n            }\n        }","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.options/src/jdk/graal/compiler/options/OptionsParser.java#L230-L266","documentation":"Thrown by OptionsParser.parseOptionValue when a numeric-typed option (Float, Double, Integer, Long) is given an empty string as its value. An empty value makes it impossible to attempt number parsing, so the parser rejects it up front with this IllegalArgumentException instead of a NumberFormatException.","triggerScenarios":"Passing 'CompileThreshold=' or ' someOption=\"\"' for any non-Boolean, non-String, non-Enum option. It fires only on the numeric branch: String options accept empty values, Enum/EnumMulti go through valueOf, Booleans get the true/false error.","commonSituations":"Templates or property files with a placeholder that was never filled in (OPT=); shell scripts building flags from unset variables (-Dgraal.Threshold=\"${VAL}\" with VAL empty); CI config where an optional numeric knob is left blank instead of omitted.","solutions":["Supply an actual number for the option named in the message.","If the knob is meant to be unset, omit the whole <name>= entry rather than leaving the value empty.","In scripts, guard with a default: VAL=${VAL:-1000} before assembling the flag."],"exampleFix":"# before\njava -Dgraal.CompileThreshold= com.app.Main\n\n# after\njava -Dgraal.CompileThreshold=1000 com.app.Main","handlingStrategy":"validation","validationCode":"boolean isNonEmptySetting(String setting) {\n    int eq = setting.indexOf('=');\n    return eq >= 0 && !setting.substring(eq + 1).isEmpty();\n}\n\nsettingsList.removeIf(s -> !isNonEmptySetting(s)); // or reject with a clear error","typeGuard":null,"tryCatchPattern":"try {\n    OptionsParser.parseOptions(settings, values, loader);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Non empty value required\")) {\n        throw new ConfigException(\"Numeric option left blank: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Default numeric env vars: VAL=${VAL:-<default>} before building flags.","Skip the whole <name>= entry when the value is empty instead of passing 'Name='.","Assert non-empty values for numeric options in config validation."],"tags":["graalvm","options","validation","configuration"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}