projectlombok/lombok · error · IllegalArgumentException

Invalid value

Error message

Invalid value: ${value}

What it means

ConfigurationDataType.parse for enum-typed configuration keys resolves a string to an enum constant. If the enum implements MappedConfigEnum, matching is done via matches(); when no constant matches, 'Invalid value: <value>' is thrown. This validates values like log, accessibility, flag usage enums in lombok.config.

Solutions

  1. Correct the value to one of the enum's accepted constants (check the key's documentation in Lombok).
  2. Check exact spelling, casing, and no stray whitespace in lombok.config.
  3. If the value was renamed, upgrade/downgrade Lombok or migrate to the new value name.

Example fix

// before (lombok.config)
lombok.accessors.flagUsage = bleh
// after
lombok.accessors.flagUsage = error
Defensive patterns

Strategy: validation

Validate before calling

boolean isValidEnumConfigValue(Class<?> enumType, String value) {
  for (Object c : enumType.getEnumConstants()) {
    if (c instanceof MappedConfigEnum && ((MappedConfigEnum) c).matches(value)) return true;
  }
  try { Enum.valueOf((Class<? extends Enum>) enumType.asSubclass(Enum.class), value); return true; } catch (Exception e) { return false; }
}

Try / catch

try {
  Object parsed = configDataType.parse(value);
} catch (IllegalArgumentException e) {
  // log the offending value and use the key's documented default
}

Prevention

When it happens

Trigger: A lombok.config key whose data type is an enum is given a string that matches no constant of the mapped enum type; Enum.valueOf fallback path also wraps unknown values into this error family.

Common situations: Misspelling an enum value in lombok.config (e.g. 'fieldInsteadof getter' variants), using a value removed/renamed in a newer Lombok, or adding whitespace/casing differences.

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


AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07). Data as JSON: /api/errors/671d2c6261147761. Report an issue: GitHub.

Appendix: source

Thrown at src/core/lombok/core/configuration/ConfigurationDataType.java:116

			@Override public String exampleValue() {
				return "[false | true]";
			}
		});
		SIMPLE_TYPES = map;
	}
	
	private static ConfigurationValueParser enumParser(final Type enumType) {
		final Class<?> type = (Class<?>) enumType;
		@SuppressWarnings("rawtypes") final Class rawType = type;
		
		return new ConfigurationValueParser() {
			@SuppressWarnings("unchecked")
			@Override public Object parse(String value) {
				if (enumType instanceof Class<?> && MappedConfigEnum.class.isAssignableFrom(type)) {
					for (Object enumVal : ((Class<?>) enumType).getEnumConstants()) {
						if (((MappedConfigEnum) enumVal).matches(value)) return enumVal;
					}
					throw new IllegalArgumentException("Invalid value: " + value);
				} else {
					try {
						return Enum.valueOf(rawType, value);
					} catch (Exception e) {
						StringBuilder sb = new StringBuilder();
						for (int i = 0; i < value.length(); i++) {
							char c = value.charAt(i);
							if (Character.isUpperCase(c) && i > 0) sb.append("_");
							sb.append(Character.toUpperCase(c));
						}
						return Enum.valueOf(rawType, sb.toString());
					}
				}
			}
			
			@Override public String description() {
				return "enum (" + type.getName() + ")";
			}

View on GitHub (pinned to 6d6a3e9fec)