{"record":{"id":"07cbc7871f510144","repo":"projectlombok/lombok","slug":"duplicate-argument-not-allowed-key","errorCode":null,"errorMessage":"Duplicate argument not allowed: <key>","messagePattern":"Duplicate argument not allowed: <key>","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java","lineNumber":189,"sourceCode":"\t\t\t\"   shadowLoaderBased                       # Add the VM options to use lombok as an agent and pass the classpath to the shadow loader. Needed for ECJ/Eclipse.\\n\" +\n\t\t\t\"   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\" +\n\t\t\t\"   favorite                                # Should the debug target be marked as favourite?\\n\" +\n\t\t\t\"\");\n\t}\n\t\n\tprivate static Map<String, String> parseArgs(String[] args) throws IllegalArgumentException {\n\t\tMap<String, String> map = new LinkedHashMap<String, String>();\n\t\t\n\t\tfor (String arg : args) {\n\t\t\tint idx = arg.indexOf('=');\n\t\t\tString key = (idx == -1 ? arg : arg.substring(0, idx)).trim();\n\t\t\tString value = (idx == -1 ? \"\" : arg.substring(idx + 1)).trim();\n\t\t\tString existing = map.get(key);\n\t\t\tif (existing != null) {\n\t\t\t\tif (key.startsWith(\"conf.\")) {\n\t\t\t\t\tvalue = existing + File.pathSeparator + value;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new IllegalArgumentException(\"Duplicate argument not allowed: \" + key);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmap.put(key, value);\n\t\t}\n\t\treturn map;\n\t}\n}","sourceCodeStart":171,"sourceCodeEnd":196,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java#L171-L196","documentation":"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>\".","triggerScenarios":"Passing e.g. 'type=x type=y' or a duplicated flag on the command line; key does not start with 'conf.'.","commonSituations":"Shell scripts appending arguments that are already hardcoded, loop-generated argument lists emitting a key twice, copy-pasted flags.","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"],"exampleFix":"// before\n... type=A type=B\n// after\n... type=A  (or conf.path=A conf.path=B for accumulating keys)","handlingStrategy":"validation","validationCode":"function parseArgs(argv) {\n  const seen = new Set();\n  for (const a of argv) {\n    const key = a.substring(0, a.indexOf('=') === -1 ? a.length : a.indexOf('=')).replace(/^-+/, '');\n    if (seen.has(key) && !key.startsWith('conf.')) throw new Error('Duplicate argument not allowed: ' + key);\n    seen.add(key);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { parseArgs(argv); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Duplicate argument\")) { dedupeAndRerun(e.getMessage()); } throw e; }","preventionTips":["Deduplicate generated argument lists before invocation","Only use repeated keys with the 'conf.' prefix","Avoid appending flags in scripts that may already be present"],"tags":["java","cli","duplicate-argument"],"backgroundTag":"invalid-cli-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"}