{"record":{"id":"6de6193d8d22b227","repo":"NationalSecurityAgency/ghidra","slug":"s-s-6de619","errorCode":null,"errorMessage":"%s: %s","messagePattern":"%s: %s","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java","lineNumber":136,"sourceCode":"\t\t\t}\n\t\t\tif (type == null) { // still\n\t\t\t\tthrow new ParseException(loc, \"%s: Invalid type %s\".formatted(loc, typeName));\n\t\t\t}\n\t\t\treturn type;\n\t\t}\n\n\t\tdefault TypeAndDefault<T> withCastDefault(ValStr<Object> defaultValue) {\n\t\t\treturn new TypeAndDefault<>(this, ValStr.cast(cls(), defaultValue));\n\t\t}\n\n\t\tClass<T> cls();\n\n\t\tdefault T decode(Location loc, String str) throws ParseException {\n\t\t\ttry {\n\t\t\t\treturn decode(str);\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tthrow new ParseException(loc, \"%s: %s\".formatted(loc, e.getMessage()));\n\t\t\t}\n\t\t}\n\n\t\tLaunchParameter<T> createParameter(String name, String display, String description,\n\t\t\t\tboolean required, ValStr<T> defaultValue);\n\t}\n\n\tprotected interface BaseType<T> extends OptType<T> {\n\t\tpublic static BaseType<?> parseNoErr(String typeName) {\n\t\t\treturn switch (typeName) {\n\t\t\t\tcase \"str\" -> BaseType.STRING;\n\t\t\t\tcase \"int\" -> BaseType.INT;\n\t\t\t\tcase \"bool\" -> BaseType.BOOL;\n\t\t\t\tcase \"path\" -> BaseType.PATH;\n\t\t\t\tcase \"dir\" -> BaseType.DIR;\n\t\t\t\tcase \"file\" -> BaseType.FILE;\n\t\t\t\tdefault -> null;\n\t\t\t};","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java#L118-L154","documentation":"Thrown as ParseException by OptType.decode(Location, String) as a catch-all wrapper when the underlying type-specific decode(str) raises any Exception. It prefixes the error with the source location (file:line) and appends the inner exception's message, so the real cause is visible (e.g., a bad int, bool, or path value).","triggerScenarios":"Providing a default or user-supplied value for a launcher parameter that fails type-specific decoding: a malformed integer, a non-bool string, or a path that throws. The Location identifies which parameter declaration is at fault.","commonSituations":"A launcher script declares '@env PORT:int=0xZZ' (bad hex); '@env FLAG:bool=yes' (not true/false); a default value with a stray character; a copy-paste error in the attribute line.","solutions":["Read the inner message after the location prefix — it names the exact decode problem (see errors 355/356 for int/bool specifics).","Correct the offending value in the launcher script's @attribute declaration to match the declared type.","If the value is user-supplied at runtime, validate it against the type before launching."],"exampleFix":"# before\n#@env PORT:int=0xZZ   # decode fails -> 'file:line: Invalid int ...'\n\n# after\n#@env PORT:int=0x1F90","handlingStrategy":"try-catch","validationCode":"// Validate the default value against its type before parsing the script\ntry { type.decode(defaultValueStr); }\ncatch (Exception e) { /* report which parameter defaulted badly */ }","typeGuard":null,"tryCatchPattern":"try { OptType.parse(loc, typeName, userEnums); }\ncatch (ParseException e) {\n    // e.getMessage() is 'file:line: <inner detail>' — log and skip the parameter\n}","preventionTips":["Test-launch launcher scripts after editing @attribute lines.","Keep a linter that decodes each default value against its declared type.","Read the inner message (after the location) to find the root decode error."],"tags":["config-parsing","value-validation","launcher-script","ghidra-debug"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}