{"record":{"id":"8f76caefff89f327","repo":"NationalSecurityAgency/ghidra","slug":"s-invalid-base-type-s","errorCode":null,"errorMessage":"%s: Invalid base type %s","messagePattern":"(.+?): Invalid base 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":160,"sourceCode":"\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};\n\t\t}\n\n\t\tpublic static BaseType<?> parse(Location loc, String typeName) throws ParseException {\n\t\t\tBaseType<?> type = parseNoErr(typeName);\n\t\t\tif (type == null) {\n\t\t\t\tthrow new ParseException(loc, \"%s: Invalid base type %s\".formatted(loc, typeName));\n\t\t\t}\n\t\t\treturn type;\n\t\t}\n\n\t\tpublic static final BaseType<String> STRING = new BaseType<>() {\n\t\t\t@Override\n\t\t\tpublic Class<String> cls() {\n\t\t\t\treturn String.class;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic String decode(String str) {\n\t\t\t\treturn str;\n\t\t\t}\n\t\t};\n\n\t\tpublic static final BaseType<BigInteger> INT = new BaseType<>() {\n\t\t\t@Override","sourceCodeStart":142,"sourceCodeEnd":178,"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#L142-L178","documentation":"Thrown as ParseException by BaseType.parse when a type name is required to be a base type specifically (not an enum) and parseNoErr returns null. The accepted base types are str, int, bool, path, dir, file. This is stricter than error 352 which also considers user enums.","triggerScenarios":"Calling BaseType.parse for a context where only primitive/file types are permitted, with a name outside the six allowed. For example, an internal path that expects a concrete base type and receives an enum name or a typo.","commonSituations":"A launcher schema element mistakenly uses an enum name where a base type is required; typo in the type keyword; a code path that bypasses enum resolution and goes straight to BaseType.parse.","solutions":["Use one of: str, int, bool, path, dir, file.","If an enum was intended, use the OptType.parse path (error 352) instead, which accepts user enums.","Check the type keyword spelling and case."],"exampleFix":"# before\nBaseType.parse(loc, \"integer\") // throws 'Invalid base type'\n\n# after\nBaseType.parse(loc, \"int\")","handlingStrategy":"validation","validationCode":"Set<String> baseTypes = Set.of(\"str\",\"int\",\"bool\",\"path\",\"dir\",\"file\");\nif (!baseTypes.contains(typeName)) throw new ParseException(loc, \"Use a base type: \" + baseTypes);","typeGuard":"boolean isBaseType(String t) {\n    return Set.of(\"str\",\"int\",\"bool\",\"path\",\"dir\",\"file\").contains(t);\n}","tryCatchPattern":null,"preventionTips":["Use only the six base type keywords where a base type is required.","Reserve enum names for OptType.parse contexts, not BaseType.parse.","Lint for type-name typos."],"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"}