{"record":{"id":"e5aa961e8196d12b","repo":"projectlombok/lombok","slug":"value-property-required-for-format","errorCode":null,"errorMessage":"'value' property required for <format>","messagePattern":"'value' property required for <format>","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/delombok/lombok/delombok/ant/DelombokTask.java","lineNumber":201,"sourceCode":"\t\t\t\tif (t instanceof Error) throw (Error) t;\n\t\t\t\tthrow new RuntimeException(t);\n\t\t\t}\n\t\t}\n\t\t\n\t\t@Override\n\t\tpublic void execute() throws BuildException {\n\t\t\tLocation loc = getLocation();\n\t\t\t\n\t\t\ttry {\n\t\t\t\tObject instance = shadowLoadClass(\"lombok.delombok.ant.DelombokTaskImpl\").getConstructor().newInstance();\n\t\t\t\tfor (Field selfField : getClass().getDeclaredFields()) {\n\t\t\t\t\tif (selfField.isSynthetic() || Modifier.isStatic(selfField.getModifiers())) continue;\n\t\t\t\t\tField otherField = instance.getClass().getDeclaredField(selfField.getName());\n\t\t\t\t\totherField.setAccessible(true);\n\t\t\t\t\tif (selfField.getName().equals(\"formatOptions\")) {\n\t\t\t\t\t\tList<String> rep = new ArrayList<String>();\n\t\t\t\t\t\tfor (Format f : formatOptions) {\n\t\t\t\t\t\t\tif (f.getValue() == null) throw new BuildException(\"'value' property required for <format>\");\n\t\t\t\t\t\t\trep.add(f.getValue());\n\t\t\t\t\t\t}\n\t\t\t\t\t\totherField.set(instance, rep);\n\t\t\t\t\t} else {\n\t\t\t\t\t\totherField.set(instance, selfField.get(this));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tMethod m = instance.getClass().getMethod(\"execute\", Location.class);\n\t\t\t\tm.invoke(instance, loc);\n\t\t\t} catch (Throwable t) {\n\t\t\t\tif (t instanceof InvocationTargetException) t = t.getCause();\n\t\t\t\tif (t instanceof RuntimeException) throw (RuntimeException) t;\n\t\t\t\tif (t instanceof Error) throw (Error) t;\n\t\t\t\tthrow new RuntimeException(t);\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/delombok/lombok/delombok/ant/DelombokTask.java#L183-L219","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"<!-- before -->\n<delombok to=\"build/delomboked\">\n  <format name=\"indent\"/>\n</delombok>\n<!-- after -->\n<delombok to=\"build/delomboked\">\n  <format name=\"indent\" value=\"tab\"/>\n</delombok>","handlingStrategy":"validation","validationCode":"for (Format f : formatOptions) {\n    if (f.getValue() == null) throw new BuildException(\"<format> needs a value attribute\");\n}","typeGuard":null,"tryCatchPattern":"// BuildException from Ant task execute(); catch in a custom task wrapper if embedding\ncatch (BuildException e) { if (e.getMessage().contains(\"'value' property\")) { /* fix build.xml */ } throw e; }","preventionTips":["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"],"tags":["ant","build","missing-attribute","format-options"],"backgroundTag":"missing-required-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"}