{"record":{"id":"38a7ef36bc244a97","repo":"Anuken/Mindustry","slug":"no-type-found-with-name-name","errorCode":null,"errorMessage":"No ${type} found with name '${name}'","messagePattern":"No (.+?) found with name '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/mod/ContentParser.java","lineNumber":918,"sourceCode":"        };\n    }\n\n    private String getString(JsonValue value, String key){\n        if(value.has(key)){\n            return value.getString(key);\n        }else{\n            throw new IllegalArgumentException(\"You are missing a \\\"\" + key + \"\\\". It must be added before the file can be parsed.\");\n        }\n    }\n\n    private String getType(JsonValue value){\n        return getString(value, \"type\");\n    }\n\n    private <T extends Content> T find(ContentType type, String name){\n        Content c = Vars.content.getByName(type, name);\n        if(c == null && currentMod != null) c = Vars.content.getByName(type, currentMod.name + \"-\" + name);\n        if(c == null) throw new IllegalArgumentException(\"No \" + type + \" found with name '\" + name + \"'\");\n        return (T)c;\n    }\n\n    private <T extends Content> TypeParser<T> parser(ContentType type, Func<String, T> constructor){\n        return (mod, name, value) -> {\n            T item;\n            if(allowPatching && locate(type, name) != null){\n                item = (T)locate(type, name);\n                readBundle(type, name, value);\n            }else{\n                readBundle(type, name, value);\n                item = constructor.get(mod + \"-\" + name);\n            }\n            currentContent = item;\n            read(() -> readFields(item, value));\n            return item;\n        };\n    }","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/mod/ContentParser.java#L900-L936","documentation":"find(ContentType, name) looks up content by exact name, then by currentMod-prefixed name (currentMod.name + \"-\" + name). If both fail, no content exists with that reference, so a downstream operation would NPE — the parser fails fast with a descriptive message instead.","triggerScenarios":"Any JSON reference (consume item, requirement block, etc.) names content that is not registered: typo, wrong content type, or not-yet-loaded content.","commonSituations":"Referring to a vanilla item by display name instead of internal name; depending on content from a mod that loads later; using the wrong ContentType.","solutions":["Use the exact internal content name (e.g. \"copper\", not \"Copper\").","Ensure the referenced content is loaded before the referencing file.","Verify the content type matches (do not look up a liquid via ContentType.item)."],"exampleFix":"// before\nfind(ContentType.item, \"Copper\")\n// after\nfind(ContentType.item, \"copper\")","handlingStrategy":"validation","validationCode":"// Verify content exists before referencing it.\nContent c = Vars.content.getByName(type, name);\nif(c == null && currentMod != null) c = Vars.content.getByName(type, currentMod.name + \"-\" + name);\nif(c == null) throw new IllegalStateException(\"No \" + type + \" named '\" + name + \"' is registered\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference content by exact internal name and correct ContentType.","Respect load order for cross-mod references."],"tags":["mindustry","modding","json","content-parser","missing-reference","content-lookup"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}