projectlombok/lombok · error · BuildException
'value' property required for
Error message
'value' property required for <format>
What it means
The Ant DelombokTask copies its `<format>` nested elements into the underlying DelombokTaskImpl via reflection. Each nested `<format>` element must carry a `value` attribute; if it is null, the task aborts with a BuildException before running delombok.
Solutions
- Add a `value` attribute to every nested `<format>` element, e.g. `<format name="indent" value="4"/>`
- Remove `<format>` elements that have no value
- Run `java -jar lombok.jar --format-help` to see valid name/value pairs
Example fix
<!-- before --> <delombok to="build/delomboked"> <format name="indent"/> </delombok> <!-- after --> <delombok to="build/delomboked"> <format name="indent" value="tab"/> </delombok>
Defensive patterns
Strategy: validation
Validate before calling
for (Format f : formatOptions) {
if (f.getValue() == null) throw new BuildException("<format> needs a value attribute");
} Try / catch
// BuildException from Ant task execute(); catch in a custom task wrapper if embedding
catch (BuildException e) { if (e.getMessage().contains("'value' property")) { /* fix build.xml */ } throw e; } Prevention
- Always pair name and value in <format> elements
- Validate build.xml with a schema or smoke-run the target in CI
- Lint for empty attributes in Ant files
When it happens
Trigger: An Ant build.xml contains `<format name="indent"/>` (or `<format value="4"/>` without a name) inside `<delombok>`, so `Format.getValue()` returns null while `execute()` copies formatOptions.
Common situations: Hand-edited Ant scripts omitting `value`; copy-pasting `<format>` elements and deleting the value attribute; relying on a default that does not exist (format options have no defaults in the Ant task).
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- The to attribute is required.
- Run java -jar lombok.jar --format-help for detailed format…
- Either 'from' attribute, or nested
- You can't specify both 'from' attribute and nested…
- Unknown charset
AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07).
Data as JSON: /api/errors/e5aa961e8196d12b.
Report an issue: GitHub.
Appendix: source
Thrown at src/delombok/lombok/delombok/ant/DelombokTask.java:201
if (t instanceof Error) throw (Error) t;
throw new RuntimeException(t);
}
}
@Override
public void execute() throws BuildException {
Location loc = getLocation();
try {
Object instance = shadowLoadClass("lombok.delombok.ant.DelombokTaskImpl").getConstructor().newInstance();
for (Field selfField : getClass().getDeclaredFields()) {
if (selfField.isSynthetic() || Modifier.isStatic(selfField.getModifiers())) continue;
Field otherField = instance.getClass().getDeclaredField(selfField.getName());
otherField.setAccessible(true);
if (selfField.getName().equals("formatOptions")) {
List<String> rep = new ArrayList<String>();
for (Format f : formatOptions) {
if (f.getValue() == null) throw new BuildException("'value' property required for <format>");
rep.add(f.getValue());
}
otherField.set(instance, rep);
} else {
otherField.set(instance, selfField.get(this));
}
}
Method m = instance.getClass().getMethod("execute", Location.class);
m.invoke(instance, loc);
} catch (Throwable t) {
if (t instanceof InvocationTargetException) t = t.getCause();
if (t instanceof RuntimeException) throw (RuntimeException) t;
if (t instanceof Error) throw (Error) t;
throw new RuntimeException(t);
}
}
}View on GitHub (pinned to 6d6a3e9fec)