{"record":{"id":"0b5e138b86f9cf9a","repo":"NationalSecurityAgency/ghidra","slug":"extraneous-parameters-extraneous","errorCode":null,"errorMessage":"Extraneous parameters: {extraneous}","messagePattern":"Extraneous parameters: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/LaunchParameter.java","lineNumber":63,"sourceCode":"\tpublic static Map<String, LaunchParameter<?>> mapOf(Collection<LaunchParameter<?>> parameters) {\n\t\tMap<String, LaunchParameter<?>> result = new LinkedHashMap<>();\n\t\tfor (LaunchParameter<?> param : parameters) {\n\t\t\tLaunchParameter<?> exists = result.put(param.name(), param);\n\t\t\tif (exists != null) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Duplicate names in parameter map: first=%s, second=%s\".formatted(exists,\n\t\t\t\t\t\tparam));\n\t\t\t}\n\t\t}\n\t\treturn Collections.unmodifiableMap(result);\n\t}\n\n\tpublic static Map<String, ValStr<?>> validateArguments(\n\t\t\tMap<String, LaunchParameter<?>> parameters, Map<String, ValStr<?>> arguments) {\n\t\tif (!parameters.keySet().containsAll(arguments.keySet())) {\n\t\t\tSet<String> extraneous = new TreeSet<>(arguments.keySet());\n\t\t\textraneous.removeAll(parameters.keySet());\n\t\t\tthrow new IllegalArgumentException(\"Extraneous parameters: \" + extraneous);\n\t\t}\n\n\t\tMap<String, String> typeErrors = null;\n\t\tfor (Map.Entry<String, ValStr<?>> ent : arguments.entrySet()) {\n\t\t\tString name = ent.getKey();\n\t\t\tValStr<?> val = ent.getValue();\n\t\t\tLaunchParameter<?> param = parameters.get(name);\n\t\t\tif (val.val() != null && !param.type.isAssignableFrom(val.val().getClass())) {\n\t\t\t\tif (typeErrors == null) {\n\t\t\t\t\ttypeErrors = new LinkedHashMap<>();\n\t\t\t\t}\n\t\t\t\ttypeErrors.put(name, \"val '%s' is not a %s\".formatted(val.val(), param.type()));\n\t\t\t}\n\t\t}\n\t\tif (typeErrors != null) {\n\t\t\tthrow new IllegalArgumentException(\"Type errors: \" + typeErrors);\n\t\t}\n\t\treturn arguments;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/LaunchParameter.java#L45-L81","documentation":"Thrown as IllegalArgumentException by LaunchParameter.validateArguments (LaunchParameter.java:60-64) when the supplied arguments map contains keys not present in the declared LaunchParameter set. The extraneous keys are collected into a sorted TreeSet and reported. This runs before type checking, so extraneous names always fail first.","triggerScenarios":"Calling validateArguments(parameters, arguments) where arguments.keySet() is not a subset of parameters.keySet(): e.g. passing an option the launcher does not declare, or a renamed parameter after a schema change.","commonSituations":"A launcher configuration/launch.properties entry referencing a parameter name that was removed or renamed; a typo in an argument key; passing UI-collected fields that no longer match the launcher's declared parameters.","solutions":["Remove the extraneous argument keys listed in the error from the arguments map.","Cross-check argument keys against the launcher's declared LaunchParameter names.","Update the declared parameters (or the caller) so the key sets agree after a schema change."],"exampleFix":"// before\nvalidateArguments(\n  Map.of(\"image\", pImage),                 // declared\n  Map.of(\"image\", vImage, \"img\", vExtra)); // 'img' not declared -> Extraneous\n\n// after\nvalidateArguments(\n  Map.of(\"image\", pImage),\n  Map.of(\"image\", vImage));","handlingStrategy":"validation","validationCode":"Set<String> unknown = new TreeSet<>(arguments.keySet());\nunknown.removeAll(parameters.keySet());\nif (!unknown.isEmpty()) {\n    throw new IllegalArgumentException(\"Remove unknown args: \" + unknown);\n}","typeGuard":"boolean argsAreSubset(Map<String,?> params, Map<String,?> args) {\n    return params.keySet().containsAll(args.keySet());\n}","tryCatchPattern":"try {\n    LaunchParameter.validateArguments(parameters, arguments);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Extraneous parameters\")) {\n        arguments.keySet().retainAll(parameters.keySet());\n        LaunchParameter.validateArguments(parameters, arguments);\n    } else throw e;\n}","preventionTips":["Filter argument keys against the declared parameter names before validating.","Keep launch.properties key names in sync with the launcher's declared parameters.","Treat schema renames as a breaking change and update callers."],"tags":["launch-parameter","argument-validation","trace-rmi","java"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}