projectlombok/lombok · error
Legal values for ' ' are ' ', or ' '.
Error message
Legal values for '%s' are '%s', or '%s'.
What it means
`unrollBoolean` validates boolean format options in FormatPreferences. Each option accepts only its designated true-string, false-string, or absence (default). Any other value throws IllegalArgumentException naming the option and its two legal values.
Solutions
- Read the message: set the named option to exactly the quoted true value or the quoted false value
- Remove the key to get the default value
- Run `java -jar lombok.jar --format-help` to see legal values per option
Example fix
// before
formatOptions.add("finalParams:yes");
// after
formatOptions.add("finalParams:generate"); // or "skip" Defensive patterns
Strategy: validation
Validate before calling
if (v != null && !trueStr.equalsIgnoreCase(v) && !falseStr.equalsIgnoreCase(v))
throw new IllegalArgumentException(name + " must be " + trueStr + " or " + falseStr); Try / catch
try { delombok.setFormatPreferences(opts); } catch (IllegalArgumentException e) { /* set option to one of the two legal values quoted in the message */ throw e; } Prevention
- Use the exact true/false words quoted in the error message
- Do not assume generic true/false is accepted
- Verify options with --format-help
When it happens
Trigger: Supplying a value for a boolean format key (e.g. `suppressWarnings`, `generated`, `finalParams`) that is neither its trueStr nor falseStr, e.g. `getters.final=true` or `skip:maybe`. Fires inside `setFormatPreferences` for every option registered via unrollBoolean.
Common situations: Using generic 'true'/'false' where the option expects 'generate'/'skip' (or vice versa); typos like 'genrate'; tooling that blindly serializes booleans into format options.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Legal values for 'emptyLines' are 'scan', 'indent', or…
- Run java -jar lombok.jar --format-help for detailed format…
- Minor version must be between 0 and 999
- Lombok supports at most v
- Invalid value
AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07).
Data as JSON: /api/errors/d9b6e2743a39a6a1.
Report an issue: GitHub.
Appendix: source
Thrown at src/delombok/lombok/delombok/FormatPreferences.java:98
this.indent = indent;
this.filledEmpties = filledEmpties;
this.generateFinalParams = unrollBoolean(preferences, "finalParams", "generate", "skip", true);
this.generateConstructorProperties = unrollBoolean(preferences, "constructorProperties", "generate", "skip", true);
this.generateSuppressWarnings = unrollBoolean(preferences, "suppressWarnings", "generate", "skip", true);
this.generateGenerated = unrollBoolean(preferences, "generated", "generate", "skip", true);
this.danceAroundIdeChecks = unrollBoolean(preferences, "danceAroundIdeChecks", "generate", "skip", true);
this.generateDelombokComment = unrollBoolean(preferences, "generateDelombokComment", "generate", "skip", true);
this.javaLangAsFqn = unrollBoolean(preferences, "javaLangAsFQN", "generate", "skip", true);
}
private static boolean unrollBoolean(Map<String, String> preferences, String name, String trueStr, String falseStr, boolean defaultVal) {
String v_ = preferences.get(name.toLowerCase());
if (v_ == null) return defaultVal;
if (trueStr.equalsIgnoreCase(v_)) return true;
if (falseStr.equalsIgnoreCase(v_)) return false;
throw new IllegalArgumentException("Legal values for '" + name + "' are '" + trueStr + "', or '" + falseStr + "'.");
}
public static Map<String, String> getKeysAndDescriptions() {
return KEYS;
}
/** If true, empty lines should still be appropriately indented. If false, empty lines should be completely blank. */
public boolean fillEmpties() {
return filledEmpties == null ? false : filledEmpties;
}
public String indent() {
return indent == null ? "\t" : indent;
}
public boolean generateSuppressWarnings() {
return generateSuppressWarnings;
}View on GitHub (pinned to 6d6a3e9fec)