{"record":{"id":"5d9a8997716be8f6","repo":"NationalSecurityAgency/ghidra","slug":"invalid-value-for","errorCode":null,"errorMessage":"Invalid value for {}","messagePattern":"Invalid value for (.+?)","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/AbstractDebuggerParameterDialog.java","lineNumber":677,"sourceCode":"\t\t}\n\t}\n\n\tprotected Map<String, ValStr<?>> collectArguments() {\n\t\tMap<String, ValStr<?>> map = new LinkedHashMap<>();\n\t\tSet<String> invalid = new LinkedHashSet<>();\n\t\tfor (Entry<P, PropertyEditor> ent : paramEditors.entrySet()) {\n\t\t\tP param = ent.getKey();\n\t\t\tPropertyEditor editor = ent.getValue();\n\t\t\tValStr<?> val = memorized.get(parameterNameAndType(param));\n\t\t\tif (!Objects.equals(editor.getAsText(), val.str())) {\n\t\t\t\tinvalid.add(parameterLabel(param));\n\t\t\t}\n\t\t\tif (val != null) {\n\t\t\t\tmap.put(parameterName(param), val);\n\t\t\t}\n\t\t}\n\t\tif (!invalid.isEmpty()) {\n\t\t\tthrow new IllegalStateException(\"Invalid value for \" + invalid);\n\t\t}\n\t\treturn map;\n\t}\n\n\tpublic Map<String, ValStr<?>> getArguments() {\n\t\treturn arguments;\n\t}\n\n\tvoid setMemorizedArgument(P parameter, ValStr<?> value) {\n\t\tif (value == null) {\n\t\t\treturn;\n\t\t}\n\t\tmemorized.put(parameterNameAndType(parameter), value);\n\t\tPropertyEditor editor = paramEditors.get(parameter);\n\t\t// Editors may not be populated yet\n\t\tif (editor != null) {\n\t\t\tsetEditorValue(editor, parameter, value);\n\t\t}","sourceCodeStart":659,"sourceCodeEnd":695,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/AbstractDebuggerParameterDialog.java#L659-L695","documentation":"Ghidra AbstractDebuggerParameterDialog.collectArguments() validates every parameter editor: if a editor's current text (getAsText()) does not equal its memorized value's string, the parameter is flagged invalid. If any parameter is invalid the method throws IllegalStateException listing the offending parameter labels, aborting argument collection.","triggerScenarios":"Invoking collectArguments() while one or more parameter editors hold text that doesn't match their memorized ValStr.str() — i.e., an uncommitted, partially edited, or unparseable value remains in a field.","commonSituations":"User clicked OK/Apply with a parameter field still in an error state; a programmatic value set bypassed the editor; a memorized value became incompatible after a platform/trace change.","solutions":["Ensure every parameter editor is committed (getAsText() matches the memorized string) before collecting arguments.","Surface the invalid set to the user and block the Apply/OK action until fields are valid.","Re-populate editors via populateValues() from current memorized values before collecting.","Catch IllegalStateException around collectArguments() and report invalid labels rather than crashing."],"exampleFix":"// before\nMap<String, ValStr<?>> args = collectArguments(); // throws if a field is dirty/invalid\n\n// after\ntry {\n    Map<String, ValStr<?>> args = collectArguments();\n} catch (IllegalStateException ex) {\n    setStatusText(\"Fix invalid parameters: \" + ex.getMessage());\n    return;\n}","handlingStrategy":"try-catch","validationCode":"// ensure all editors are committed before collecting\nboolean allValid = true;\nfor (PropertyEditor ed : paramEditors.values()) {\n    // confirm ed.getAsText() is parseable / matches a memorized value\n    if (!isEditorValid(ed)) allValid = false;\n}\nif (!allValid) return;","typeGuard":null,"tryCatchPattern":"try {\n    Map<String, ValStr<?>> args = collectArguments();\n} catch (IllegalStateException ex) {\n    // ex.getMessage() lists invalid parameter labels; show to user\n}","preventionTips":["Block Apply/OK while any field shows an error.","Re-run populateValues() to recommit editors before collectArguments().","Validate on focus-loss so invalid state is visible early."],"tags":["ghidra","debugger","java","validation","ui"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}