{"record":{"id":"2c2724fbc8000e11","repo":"projectlombok/lombok","slug":"format-keys-need-to-be-2-values-separated-with-a-c","errorCode":null,"errorMessage":"Format keys need to be 2 values separated with a colon.","messagePattern":"Format keys need to be 2 values separated with a colon\\.","errorType":"console","errorClass":"InvalidFormatOptionException","httpStatus":null,"severity":"error","filePath":"src/delombok/lombok/delombok/Delombok.java","lineNumber":469,"sourceCode":"\t}\n\t\n\tpublic static class InvalidFormatOptionException extends Exception {\n\t\tpublic InvalidFormatOptionException(String msg) {\n\t\t\tsuper(msg);\n\t\t}\n\t}\n\t\n\tpublic static Map<String, String> formatOptionsToMap(List<String> formatOptions) throws InvalidFormatOptionException {\n\t\tboolean prettyEnabled = false;\n\t\tMap<String, String> formatPrefs = new HashMap<String, String>();\n\t\tfor (String format : formatOptions) {\n\t\t\tint idx = format.indexOf(':');\n\t\t\tif (idx == -1) {\n\t\t\t\tif (format.equalsIgnoreCase(\"pretty\")) {\n\t\t\t\t\tprettyEnabled = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new InvalidFormatOptionException(\"Format keys need to be 2 values separated with a colon.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tString key = format.substring(0, idx);\n\t\t\tString value = format.substring(idx + 1);\n\t\t\tboolean valid = false;\n\t\t\tfor (String k : FormatPreferences.getKeysAndDescriptions().keySet()) {\n\t\t\t\tif (k.equalsIgnoreCase(key)) {\n\t\t\t\t\tvalid = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!valid) throw new InvalidFormatOptionException(\"Unknown format key: '\" + key + \"'.\");\n\t\t\tformatPrefs.put(key.toLowerCase(), value);\n\t\t}\n\t\t\n\t\tif (prettyEnabled) {\n\t\t\tif (!formatPrefs.containsKey(\"suppresswarnings\")) formatPrefs.put(\"suppresswarnings\", \"skip\");\n\t\t\tif (!formatPrefs.containsKey(\"generated\")) formatPrefs.put(\"generated\", \"skip\");","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/delombok/lombok/delombok/Delombok.java#L451-L487","documentation":"Delombok.formatOptionsToMap converts --format key:value pairs into a format-preferences map, with 'pretty' allowed as a bare flag. If a format option contains no colon and is not the special 'pretty' token, it throws InvalidFormatOptionException(\"Format keys need to be 2 values separated with a colon.\").","triggerScenarios":"Running delombok with --format (or -f) passing a value without a colon, e.g. -f sortmembers or -f pretty:extra where the intended syntax was key:value; only the exact token 'pretty' is permitted without a colon.","commonSituations":"Guessing CLI syntax (passing just a key name instead of key:value), forgetting the value after the colon (e.g. -f indent:), or copying a '-f pretty' example and appending extra words.","solutions":["Use key:value syntax, e.g. -f indent:4 -f suppresswarnings:skip","If you only want the shortcut, pass exactly -f pretty with no extra text","List valid keys with delombok --help or FormatPreferences.getKeysAndDescriptions() and pick one to pair with a value"],"exampleFix":"// before\ndelombok src -d out -f sortmembers\n// after\ndelombok src -d out -f sortmembers:true","handlingStrategy":"validation","validationCode":"boolean validFormatOption(String opt) {\n    if (opt.equalsIgnoreCase(\"pretty\")) return true;\n    return opt.indexOf(':') != -1 && !opt.endsWith(\":\");\n}","typeGuard":null,"tryCatchPattern":"try { delombok.formatOptionsToMap(opts); } catch (InvalidFormatOptionException e) { System.err.println(e.getMessage() + \" Use -f key:value or -f pretty\"); System.exit(2); }","preventionTips":["Always use key:value syntax for --format","Reserve bare 'pretty' for the shortcut only","Consult FormatPreferences.getKeysAndDescriptions() for the exact syntax"],"tags":["delombok","cli","format-options"],"backgroundTag":"invalid-cli-argument","analyzedSha":"6d6a3e9fec0a9555702561fbeb8eac836575116e","analyzedAt":"2026-09-07T23:18:01.841Z","contentChangedAt":"2026-09-07T23:18:01.841Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}