{"record":{"id":"02b2aca86575c2ed","repo":"NationalSecurityAgency/ghidra","slug":"missing-required-parameter-key","errorCode":null,"errorMessage":"Missing required parameter '{key}'","messagePattern":"Missing required parameter '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteMethod.java","lineNumber":166,"sourceCode":"\t/**\n\t * Validate the given argument.\n\t * \n\t * <p>\n\t * This method is for checking parameter sanity before they are marshalled to the back-end. This\n\t * is called automatically during invocation. Clients can use this method to pre-test or\n\t * validate in the UI, when invocation is not yet desired.\n\t * \n\t * @param arguments the arguments\n\t * @return the trace if any object arguments were given, or null\n\t * @throws IllegalArgumentException if the arguments are not valid\n\t */\n\tdefault Trace validate(Map<String, Object> arguments) {\n\t\tTrace trace = null;\n\t\tSchemaContext ctx = PrimitiveTraceObjectSchema.MinimalSchemaContext.INSTANCE;\n\t\tfor (Map.Entry<String, RemoteParameter> ent : parameters().entrySet()) {\n\t\t\tif (!arguments.containsKey(ent.getKey())) {\n\t\t\t\tif (ent.getValue().required()) {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"Missing required parameter '\" + ent.getKey() + \"'\");\n\t\t\t\t}\n\t\t\t\tcontinue; // Should not need to check the default value\n\t\t\t}\n\t\t\tObject arg = arguments.get(ent.getKey());\n\t\t\tif (arg instanceof TraceObject obj) {\n\t\t\t\tif (trace == null) {\n\t\t\t\t\ttrace = obj.getTrace();\n\t\t\t\t\tctx = trace.getObjectManager().getRootSchema().getContext();\n\t\t\t\t}\n\t\t\t\telse if (trace != obj.getTrace()) {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"All TraceObject parameters must come from the same trace\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSchemaName schName = ent.getValue().type();\n\t\t\tTraceObjectSchema sch = ctx.getSchemaOrNull(schName);\n\t\t\tcheckType(ent.getKey(), schName, sch, arg);","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteMethod.java#L148-L184","documentation":"Thrown by RemoteMethod.validate() when an argument map is missing a parameter that is declared required()=true. This is the validate()-path counterpart to the typed get() in LaunchParameter. validate() iterates over the method's declared parameters and checks each argument for presence and type.","triggerScenarios":"Calling remoteMethod.validate(arguments) where arguments does not contain a key whose RemoteParameter.required() returns true.","commonSituations":"Pre-testing arguments in UI code before invoking a debugger remote method; constructing the argument map programmatically and forgetting a mandatory key.","solutions":["Inspect the method's parameters() map and include every parameter where required() is true.","Call validate() early during form/argument construction to surface missing keys before invocation.","Use the parameter default values for optional ones instead of omitting them."],"exampleFix":"// before\nmethod.validate(Map.of(\"x\", val)); // 'y' is required but omitted\n\n// after\nMap<String,Object> args = new HashMap<>();\nargs.put(\"x\", val);\nargs.put(\"y\", yVal);\nmethod.validate(args);","handlingStrategy":"validation","validationCode":"// Pre-validate required keys:\nSet<String> requiredKeys = method.parameters().entrySet().stream()\n    .filter(e -> e.getValue().required())\n    .map(Map.Entry::getKey)\n    .collect(Collectors.toSet());\nif (!arguments.keySet().containsAll(requiredKeys)) {\n    requiredKeys.removeAll(arguments.keySet());\n    throw new IllegalStateException(\"Missing: \" + requiredKeys);\n}","typeGuard":null,"tryCatchPattern":"try {\n    method.validate(arguments);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Missing required parameter\")) {\n        // collect the missing key and request it from the user\n    } else throw e;\n}","preventionTips":["Derive required keys from parameters() rather than hardcoding.","Validate early in the UI flow so missing fields surface before invocation."],"tags":["tracermi","remote-method","argument-validation","debugger"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}