{"record":{"id":"f09829ba2a8f01a5","repo":"NationalSecurityAgency/ghidra","slug":"missing-required-parameter-s-s","errorCode":null,"errorMessage":"Missing required parameter '%s' (%s)","messagePattern":"Missing required parameter '(.+?)' \\((.+?)\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/LaunchParameter.java","lineNumber":97,"sourceCode":"\t\t\tthrow new IllegalArgumentException(\"Type errors: \" + typeErrors);\n\t\t}\n\t\treturn arguments;\n\t}\n\n\tpublic static Map<String, LaunchParameter<?>> mapOf(LaunchParameter<?>... parameters) {\n\t\treturn mapOf(Arrays.asList(parameters));\n\t}\n\n\tpublic ValStr<T> decode(String string) {\n\t\treturn decoder.decodeValStr(string);\n\t}\n\n\tpublic ValStr<T> get(Map<String, ValStr<?>> arguments) {\n\t\tif (arguments.containsKey(name)) {\n\t\t\treturn ValStr.cast(type, arguments.get(name));\n\t\t}\n\t\tif (required) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Missing required parameter '%s' (%s)\".formatted(display, name));\n\t\t}\n\t\treturn defaultValue;\n\t}\n\n\tpublic void set(Map<String, ValStr<?>> arguments, ValStr<T> value) {\n\t\targuments.put(name, value);\n\t}\n}\n","sourceCodeStart":79,"sourceCodeEnd":107,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/LaunchParameter.java#L79-L107","documentation":"Thrown by LaunchParameter.get() when a required launch parameter is absent from the arguments map. The message interpolates the parameter's display name and internal name. This is part of the Trace RMI launch-argument handling: each launch parameter has a name, type, default value, and a required flag, and get() retrieves it from a supplied argument map.","triggerScenarios":"Calling LaunchParameter.get(arguments) where arguments is a Map<String,ValStr<?>> missing the entry for this parameter's name, while the parameter's required flag is true and no default value exists.","commonSituations":"Building a trace RMI launch invocation (e.g., invoking a debugger target launch method) without supplying all mandatory arguments; UI code that constructs the argument map from partially-filled form fields before the user finished entering required values.","solutions":["Before calling get(), check arguments.containsKey(name) and supply all required parameters' values first.","Populate the arguments map by iterating over the method's declared parameters and providing a value for each required one.","If the parameter should be optional, ensure it was declared with required=false and/or a non-null default value."],"exampleFix":"// before\nValStr<T> val = param.get(arguments); // throws if missing & required\n\n// after\nif (!arguments.containsKey(param.name) && param.required) {\n    throw new IllegalStateException(\"Must supply \" + param.name);\n}\nValStr<T> val = param.get(arguments);","handlingStrategy":"validation","validationCode":"// Before calling param.get(arguments):\nSet<String> required = params.stream()\n    .filter(LaunchParameter::required)\n    .map(p -> p.name)\n    .collect(Collectors.toSet());\nSet<String> missing = new HashSet<>(required);\nmissing.removeAll(arguments.keySet());\nif (!missing.isEmpty()) {\n    throw new IllegalStateException(\"Missing: \" + missing);\n}","typeGuard":"// No type narrowing needed; guard on map contents\nstatic boolean hasAllRequired(List<LaunchParameter> params,\n        Map<String, ValStr<?>> args) {\n    return params.stream().filter(LaunchParameter::required)\n        .allMatch(p -> args.containsKey(p.name));\n}","tryCatchPattern":"try {\n    ValStr<T> v = param.get(arguments);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Missing required parameter\")) {\n        // prompt user for the value, then retry\n    } else throw e;\n}","preventionTips":["Build the argument map by iterating declared parameters so no required key is skipped.","Call the bulk validate() in UI code to surface missing keys before invocation."],"tags":["tracermi","launch-parameter","argument-validation","debugger"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}