{"record":{"id":"6d293e212bdcb1b1","repo":"quarkusio/quarkus","slug":"failed-to-format-option-dash-xx-collon-getname","errorCode":null,"errorMessage":"Failed to format option ${DASH_XX_COLLON + getName()} with values ${getValues()}","messagePattern":"Failed to format option (.+?) with values (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableXxJvmOption.java","lineNumber":59,"sourceCode":"        return COMPLETE_PROPERTY_PREFIX;\n    }\n\n    @Override\n    public List<String> toCliOptions() {\n        if (!hasValue()) {\n            return toBooleanOption(true);\n        }\n        if (getValues().size() == 1) {\n            var value = getValues().iterator().next();\n            if (\"true\".equalsIgnoreCase(value) || \"+\".equals(value)) {\n                return toBooleanOption(true);\n            }\n            if (\"false\".equalsIgnoreCase(value) || \"-\".equals(value)) {\n                return toBooleanOption(false);\n            }\n            return List.of(DASH_XX_COLLON + getName() + \"=\" + value);\n        }\n        throw new IllegalArgumentException(\n                \"Failed to format option \" + DASH_XX_COLLON + getName() + \" with values \" + getValues());\n    }\n\n    private List<String> toBooleanOption(boolean enabled) {\n        return List.of(DASH_XX_COLLON + (enabled ? \"+\" : \"-\") + getName());\n    }\n}\n","sourceCodeStart":41,"sourceCodeEnd":67,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableXxJvmOption.java#L41-L67","documentation":"MutableXxJvmOption.toCliOptions() converts an -XX option's stored values into -XX:... CLI flags. It handles true/false/'+'/'-' boolean values and single key=value pairs; if the value set has any other shape (multiple values or an unrecognized value on a multi-valued option) it cannot be represented as CLI flags and throws this IllegalArgumentException.","triggerScenarios":"Calling toCliOptions() on an -XX option that has multiple values, or a value that is not 'true'/'false'/'+'/'-' and the option ended up with more than one entry so no single 'name=value' form can be produced.","commonSituations":"Adding several values to an -XX option via addValue with '|' or repeated calls, then serializing to CLI; migrating options between Properties form (which supports '|'-separated multi-values) and CLI form.","solutions":["Ensure each -XX option carries exactly one value (use separate options for distinct values)","Use recognized boolean literals ('true','false','+','-') for boolean -XX options","If you control the input, normalize the option's values before invoking toCliOptions()"],"exampleFix":"// before\nxxOption.addValue(\"PerfDisableSharedMem\").addValue(\"UseAES\");\n// after\nxxOption.addValue(\"PerfDisableSharedMem\");\nXxJvmOption other = new MutableXxJvmOption(\"UseAES\").addValue(\"true\");","handlingStrategy":"validation","validationCode":"boolean isFormattableXx(MutableXxJvmOption o) {\n    var values = o.getValues();\n    return values.size() <= 1;\n}\n// call only when isFormattableXx(option) is true","typeGuard":"boolean isSingleValued(Collection<String> v) { return v.size() <= 1; }","tryCatchPattern":"try {\n    List<String> cli = xxOption.toCliOptions();\n} catch (IllegalArgumentException e) {\n    log.errorf(\"Cannot serialize -XX option %s to CLI: %s\", xxOption.getName(), e.getMessage());\n}","preventionTips":["Keep one value per -XX option; split multi-values into separate options","Use only true/false/+/- for boolean -XX flags","Prefer the Properties representation for multi-valued options instead of CLI form"],"tags":["jvm-options","xx-options","format-validation"],"backgroundTag":"option-format-invalid","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}