{"record":{"id":"61628e89b0e19f26","repo":"Anuken/Mindustry","slug":"type-not-found-base","errorCode":null,"errorMessage":"Type not found: ${base}","messagePattern":"Type not found: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/mod/ContentParser.java","lineNumber":1457,"sourceCode":"        if(out != null) return (Class<T>)out;\n\n        //try to resolve it as a raw class name\n        if(base.indexOf('.') != -1 && allowClassResolution){\n            try{\n                return (Class<T>)Class.forName(base);\n            }catch(Exception ignored){\n                //try to use mod class loader\n                try{\n                    return (Class<T>)Class.forName(base, true, mods.mainLoader());\n                }catch(Exception ignore){}\n            }\n        }\n\n        if(def != null){\n            if(warn) warn(\"[@] No type '\" + base + \"' found, defaulting to type '\" + def.getSimpleName() + \"'\", currentFile != null ? currentFile : currentMod != null ? currentMod.name : \"\");\n            return def;\n        }\n        throw new IllegalArgumentException(\"Type not found: \" + base);\n    }\n\n    void warn(String string, Object... format){\n        warnContext(currentContent, currentFile, string, format);\n    }\n\n    void warnContext(@Nullable Content currentContent, @Nullable Fi currentFile, String string, Object... format){\n        Log.warn(string, format);\n    }\n\n    void onNewInstance(Object object, Class<?> type){}\n\n    public Json getJson(){\n        checkInit();\n        return parser;\n    }\n\n    private interface FieldParser{","sourceCodeStart":1439,"sourceCodeEnd":1475,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/mod/ContentParser.java#L1439-L1475","documentation":"When resolving a 'type' string to a Java class, ContentParser tries arc., mindustry., then the mod classloader, and finally a provided default. If no class is found and no default (def) was supplied, it throws IllegalArgumentException 'Type not found: <base>'. This maps JSON type names to concrete content classes.","triggerScenarios":"A mod JSON 'type' field names a class that does not exist on the classpath or is misspelled, and the parser was not given a fallback type.","commonSituations":"Typo in the type string; mod references a class added in a newer/older game version; custom content class not packaged in the mod jar; wrong package prefix.","solutions":["Verify the exact fully-qualified or simple name in the 'type' field against a real class.","Ensure custom classes are compiled into the mod jar and on the mod classloader.","Check game version compatibility for the class you reference.","Use a known vanilla type string as a sanity check."],"exampleFix":"// before\n{ \"type\": \"mindustry.world.blocks.Turret\", \"name\": \"x\" }\n\n// after (real vanilla block subclass)\n{ \"type\": \"Turret\", \"name\": \"x\" }","handlingStrategy":"validation","validationCode":"// Check a type string resolves before parsing content that needs it.\nClass<?> c = null;\ntry { c = Class.forName(typeName, false, mods.mainLoader()); } catch(ClassNotFoundException ignored) {}\nif(c == null) throw new IllegalArgumentException(\"Unknown content type: \" + typeName);","typeGuard":"boolean typeResolves(String name){\n    try { Class.forName(name, false, mods.mainLoader()); return true; }\n    catch(ClassNotFoundException e){ return false; }\n}","tryCatchPattern":"try {\n    parser.resolveType(base, def, warn);\n} catch(IllegalArgumentException e) {\n    if(e.getMessage().startsWith(\"Type not found\")) { /* prompt user to fix type string */ }\n    else throw e;\n}","preventionTips":["Verify every 'type' string against real classes in the target game version.","Package custom content classes in the mod jar.","Avoid hard-coding fully-qualified names prone to refactors."],"tags":["modding","content-parsing","classloading","reflection"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}