{"record":{"id":"3a7340fbef7427ab","repo":"NationalSecurityAgency/ghidra","slug":"byte-array-values-must-be-hex-enclosed-in","errorCode":null,"errorMessage":"Byte array values must be hex enclosed in {}","messagePattern":"Byte array values must be hex enclosed in (.+?)","errorType":"validation","errorClass":"NumberFormatException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/variable/AbstractDebuggerVariableViewerVarValue.java","lineNumber":177,"sourceCode":"\t\t\treturn \"{ \" + NumericUtilities.convertBytesToString(value, 0, 64, \" \") + \" ... }\";\n\t\t}\n\t\treturn \"{ \" + NumericUtilities.convertBytesToString(value, \" \") + \" }\";\n\t}\n\n\tpublic void setValue(String valueString) {\n\t\tif ((value == null) || (language == null)) {\n\t\t\tthrow new AssertionError(\"Value and language cannot be null\");\n\t\t}\n\t\tif ((getDataType() == null) || (value == null)) {\n\t\t\t// isValueEditable should have been false\n\t\t\tMsg.error(this, \"No value or no data type\");\n\t\t\treturn;\n\t\t}\n\n\t\tvalueString = valueString.trim();\n\t\tif (valueString.startsWith(\"{\")) {\n\t\t\tif (!valueString.endsWith(\"}\")) {\n\t\t\t\tthrow new NumberFormatException(\"Byte array values must be hex enclosed in {}\");\n\t\t\t}\n\n\t\t\tsetRawValueBytesString(valueString.substring(1, valueString.length() - 1));\n\t\t\treturn;\n\t\t}\n\n\t\tsetRawValueIntString(valueString);\n\t}\n\n\tprivate void setRawValueBytesString(String bytesString) {\n\t\tsetRawValueBytes(NumericUtilities.convertStringToBytes(bytesString));\n\t}\n\n\tprivate void setRawValueIntString(String intString) {\n\t\tintString = intString.trim();\n\t\tfinal BigInteger val;\n\t\tif (intString.startsWith(\"0x\")) {\n\t\t\tval = new BigInteger(intString.substring(2), 16);","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/variable/AbstractDebuggerVariableViewerVarValue.java#L159-L195","documentation":"Thrown by AbstractDebuggerVariableViewerVarValue when a value string begins with '{' (signaling a byte-array/hex literal) but does not end with '}'. Byte-array values must be fully braced; the parser refuses a dangling opening brace.","triggerScenarios":"User enters a value string starting with '{' but missing the closing '}' in the Variables viewer value field.","commonSituations":"Typo or partial paste of a byte-array literal (e.g., '{deadbeef'); forgetting to close the brace; copy-paste truncation.","solutions":["Complete the byte-array literal with a closing brace, e.g., '{deadbeef}'.","If entering a scalar/integer value, do not prefix with '{'.","Validate the input in the UI: a leading '{' must pair with a trailing '}'.","Strip stray braces from pasted content before submission."],"exampleFix":"// before\nsetRawValueString(\"{deadbeef\"); // missing closing brace -> NumberFormatException\n\n// after\nsetRawValueString(\"{deadbeef}\"); // well-formed byte-array literal","handlingStrategy":"validation","validationCode":"String s = valueString.trim();\nboolean wellFormed = !s.startsWith(\"{\") || s.endsWith(\"}\");","typeGuard":"static boolean wellFormedByteArray(String s) {\n    s = s.trim();\n    return !s.startsWith(\"{\") || s.endsWith(\"}\");\n}","tryCatchPattern":"try {\n    varValue.setRawValueString(s);\n} catch (NumberFormatException e) {\n    showError(\"Unmatched '{': byte arrays must be hex enclosed in {}\");\n}","preventionTips":["Pair every '{' with '}' for byte-array literals.","Validate brace pairing in the UI field before submit."],"tags":["variable","bytes","user-input","parsing"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}