{"record":{"id":"d43daff875542e59","repo":"NationalSecurityAgency/ghidra","slug":"unsupported-value","errorCode":null,"errorMessage":"Unsupported value: {}","messagePattern":"Unsupported value: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/AbstractDebuggerParameterDialog.java","lineNumber":349,"sourceCode":"\t\tprivate final List<?> choices;\n\t\tprivate final String[] tags;\n\n\t\tprivate final List<PropertyChangeListener> listeners = new ArrayList<>();\n\n\t\tprivate Object value;\n\n\t\tpublic ChoicesPropertyEditor(Collection<?> choices) {\n\t\t\tthis.choices = choices.stream().distinct().toList();\n\t\t\tthis.tags = choices.stream().map(Objects::toString).toArray(String[]::new);\n\t\t}\n\n\t\t@Override\n\t\tpublic void setValue(Object value) {\n\t\t\tif (Objects.equals(value, this.value)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!choices.contains(value)) {\n\t\t\t\tthrow new IllegalArgumentException(\"Unsupported value: \" + value);\n\t\t\t}\n\t\t\tObject oldValue;\n\t\t\tList<PropertyChangeListener> listeners;\n\t\t\tsynchronized (this.listeners) {\n\t\t\t\toldValue = this.value;\n\t\t\t\tthis.value = value;\n\t\t\t\tif (this.listeners.isEmpty()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlisteners = List.copyOf(this.listeners);\n\t\t\t}\n\t\t\tPropertyChangeEvent evt = new PropertyChangeEvent(this, null, oldValue, value);\n\t\t\tfor (PropertyChangeListener l : listeners) {\n\t\t\t\tl.propertyChange(evt);\n\t\t\t}\n\t\t}\n\n\t\t@Override","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/AbstractDebuggerParameterDialog.java#L331-L367","documentation":"Ghidra ChoicesPropertyEditor.setValue(Object) rejects a value not contained in the choices collection given at construction. choices is a distinct, deduplicated list and membership uses Object.equals, so an equal-by-content but different-type object (or null not in the set) is rejected. Throws IllegalArgumentException before mutating state.","triggerScenarios":"Calling setValue(v) where v is not among the original choices; passing a boxed type that differs from the choices' element type; passing null when null was not a choice.","commonSituations":"A dropdown/combobox model pushes a selected value that was filtered out of the choices; an enum vs String type mismatch; loading a saved/memorized value that no longer exists in the current choice set.","solutions":["Check choices.contains(value) (or editor getter) before calling setValue.","Ensure the value's type and equals() match the choices' elements exactly.","Refresh the editor with a choices collection that includes the value you intend to set.","Guard against null when null is not a permitted choice."],"exampleFix":"// before\neditor.setValue(candidate); // throws if not in choices\n\n// after\nif (editor.getTags() == null || java.util.Arrays.asList(editor.getTags()).contains(String.valueOf(candidate))) {\n    editor.setAsText(String.valueOf(candidate));\n}","handlingStrategy":"validation","validationCode":"Collection<?> choices = ...; // same set given to the editor\nif (choices != null && choices.contains(value)) {\n    editor.setValue(value);\n} else {\n    // log / pick a default from choices\n}","typeGuard":"boolean isAcceptableChoice(java.beans.PropertyEditor ed, Object v) {\n    String[] tags = ed.getTags();\n    return tags != null && java.util.Arrays.asList(tags).contains(String.valueOf(v));\n}","tryCatchPattern":"try {\n    editor.setValue(value);\n} catch (IllegalArgumentException ex) {\n    // value not in choices; fall back to choices.iterator().next()\n}","preventionTips":["Refresh the editor's choices when the source set changes.","Ensure value type/equals matches choice elements.","Make combo boxes non-editable to prevent unlisted submissions."],"tags":["ghidra","debugger","java","property-editor","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}