projectlombok/lombok · error · IllegalArgumentException
Duplicate argument not allowed
Error message
Duplicate argument not allowed: <key>
What it means
parseArgs rejects supplying the same non-'conf.' key twice. Only keys prefixed 'conf.' may repeat (values joined with the path separator); anything else throws IllegalArgumentException "Duplicate argument not allowed: <key>".
Solutions
- Remove the duplicate occurrence of the named argument
- If you intended multiple values, use the 'conf.' prefix keys which accumulate with the path separator
- Deduplicate arguments programmatically in generating scripts
- Use a map-style construction so each key appears once
Example fix
// before ... type=A type=B // after ... type=A (or conf.path=A conf.path=B for accumulating keys)
Defensive patterns
Strategy: validation
Validate before calling
function parseArgs(argv) {
const seen = new Set();
for (const a of argv) {
const key = a.substring(0, a.indexOf('=') === -1 ? a.length : a.indexOf('=')).replace(/^-+/, '');
if (seen.has(key) && !key.startsWith('conf.')) throw new Error('Duplicate argument not allowed: ' + key);
seen.add(key);
}
} Try / catch
try { parseArgs(argv); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Duplicate argument")) { dedupeAndRerun(e.getMessage()); } throw e; } Prevention
- Deduplicate generated argument lists before invocation
- Only use repeated keys with the 'conf.' prefix
- Avoid appending flags in scripts that may already be present
When it happens
Trigger: Passing e.g. 'type=x type=y' or a duplicated flag on the command line; key does not start with 'conf.'.
Common situations: Shell scripts appending arguments that are already hardcoded, loop-generated argument lists emitting a key twice, copy-pasted flags.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- mandatory argument ' ' missing
- 4 args required: [path to creds file] [path to file root to…
- 4th arg must be 'true' or 'false'
- 4th argument must be one of 'all', 'changelog'…
- Format keys need to be 2 values separated with a colon.
AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07).
Data as JSON: /api/errors/07cbc7871f510144.
Report an issue: GitHub.
Appendix: source
Thrown at src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java:189
" shadowLoaderBased # Add the VM options to use lombok as an agent and pass the classpath to the shadow loader. Needed for ECJ/Eclipse.\n" +
" conf.test=foo:bar:baz # Where 'test' is an ivy conf name, and 'foo' is a path to a jar, relativized vs. current directory.\n" +
" favorite # Should the debug target be marked as favourite?\n" +
"");
}
private static Map<String, String> parseArgs(String[] args) throws IllegalArgumentException {
Map<String, String> map = new LinkedHashMap<String, String>();
for (String arg : args) {
int idx = arg.indexOf('=');
String key = (idx == -1 ? arg : arg.substring(0, idx)).trim();
String value = (idx == -1 ? "" : arg.substring(idx + 1)).trim();
String existing = map.get(key);
if (existing != null) {
if (key.startsWith("conf.")) {
value = existing + File.pathSeparator + value;
} else {
throw new IllegalArgumentException("Duplicate argument not allowed: " + key);
}
}
map.put(key, value);
}
return map;
}
}View on GitHub (pinned to 6d6a3e9fec)