{"record":{"id":"2e0fad3ade27681c","repo":"NationalSecurityAgency/ghidra","slug":"s-invalid-type-s","errorCode":null,"errorMessage":"%s: Invalid type %s","messagePattern":"(.+?): Invalid type (.+?)","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":120,"sourceCode":"\t\t}\n\t}\n\n\tprotected record Location(String fileName, int lineNo) {\n\t\t@Override\n\t\tpublic String toString() {\n\t\t\treturn \"%s:%d\".formatted(fileName, lineNo);\n\t\t}\n\t}\n\n\tprotected interface OptType<T> extends ValStr.Decoder<T> {\n\t\tstatic OptType<?> parse(Location loc, String typeName, Map<String, UserType<?>> userEnums)\n\t\t\t\tthrows ParseException {\n\t\t\tOptType<?> type = BaseType.parseNoErr(typeName);\n\t\t\tif (type == null) {\n\t\t\t\ttype = userEnums.get(typeName);\n\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}","sourceCodeStart":102,"sourceCodeEnd":138,"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#L102-L138","documentation":"Thrown as ParseException by OptType.parse when a declared type name is neither a recognized base type (str/int/bool/path/dir/file) nor a key in the userEnums map. This occurs while parsing the @attribute type declarations of a launcher script, so it surfaces at launcher-parameter schema build time.","triggerScenarios":"A launcher script declares a parameter with a type like '@env TYPE=mytype' where 'mytype' is not one of the six base types and was not declared as a user enum earlier in the same script. The parser exhausts both base-type and enum lookups and rejects the declaration.","commonSituations":"Typo in the type keyword (e.g., 'integer' instead of 'int', 'string' instead of 'str'); referencing an enum name that was never declared; a script edited by hand introducing an invalid type; version skew where a new type name was expected but isn't supported by this parser.","solutions":["Use one of the valid base types: str, int, bool, path, dir, file.","If a custom enum is intended, ensure it is declared as a user enum earlier in the script before referencing it.","Check for typos in the type name — it is case-sensitive."],"exampleFix":"# before\n#@env COUNT:integer=5   # 'integer' is invalid\n\n# after\n#@env COUNT:int=5","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"str\",\"int\",\"bool\",\"path\",\"dir\",\"file\");\nif (!valid.contains(typeName) && !userEnums.containsKey(typeName)) {\n    throw new ParseException(loc, \"Unknown type: \" + typeName);\n}","typeGuard":"boolean isValidTypeName(String t, Set<String> userEnumNames) {\n    return Set.of(\"str\",\"int\",\"bool\",\"path\",\"dir\",\"file\").contains(t) || userEnumNames.contains(t);\n}","tryCatchPattern":null,"preventionTips":["Restrict type names to the six base types or previously declared enums.","Lint launcher scripts for type-keyword typos before runtime.","Declare user enums before referencing them in parameter types."],"tags":["config-parsing","type-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"}