Anuken/Mindustry · error · IllegalArgumentException

${jsonData.name == null ? "" : "\"" + jsonData.name + "\": "

Error message

${jsonData.name == null ? "" : "\"" + jsonData.name + "\": "}No ${ctype} found with name '${jsonData.asString()}'.
Make sure '${jsonData.asString()}' is spelled correctly, and that it really exists!
This may also occur because its file failed to parse.

What it means

Thrown when the target type is a specific Content subclass: the parser looks up by mod-prefixed name then bare name, and if neither exists it rejects with the content type, the name, and a note that the file may have failed to parse.

Source

Thrown at core/src/mindustry/mod/ContentParser.java:515

                if(type == UnlockableContent.class){
                    for(ContentType c : typesToSearch){
                        T found = (T)locate(c, jsonData.asString());
                        if(found != null){
                            return found;
                        }
                    }
                    throw new IllegalArgumentException("\"" + jsonData.name + "\": No content found with name '" + jsonData.asString() + "'.");
                }

                if(Content.class.isAssignableFrom(type)){
                    ContentType ctype = contentTypes.getThrow(type, () -> new IllegalArgumentException("No content type for class: " + type.getSimpleName()));
                    String prefix = currentMod != null ? currentMod.name + "-" : "";
                    T one = (T)Vars.content.getByName(ctype, prefix + jsonData.asString());
                    if(one != null) return one;
                    T two = (T)Vars.content.getByName(ctype, jsonData.asString());

                    if(two != null) return two;
                    throw new IllegalArgumentException((jsonData.name == null ? "" : "\"" + jsonData.name + "\": ") + "No " + ctype + " found with name '" + jsonData.asString() + "'.\nMake sure '" + jsonData.asString() + "' is spelled correctly, and that it really exists!\nThis may also occur because its file failed to parse.");
                }
            }

            return super.readValue(type, elementType, jsonData, keyType);
        }
    };

    public void readBlockConsumers(Block block, JsonValue value){
        for(JsonValue child : value){
            switch(child.name){
                case "remove" -> {
                    String[] values = child.isString() ? new String[]{child.asString()} : child.asStringArray();
                    for(String type : values){
                        if(type.equals("all")){
                            block.removeConsumers(b -> true);
                        }else{
                            Class<?> consumeType = resolve("Consume" + Strings.capitalize(type), Consume.class);
                            if(consumeType != Consume.class){

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Check spelling of the referenced name exactly as registered.
  2. Verify the referenced content's file parsed successfully (earlier errors block later lookups).
  3. Account for the mod-name prefix: cross-mod references may need the owning mod's prefix.

Example fix

// before
"liquid": "water2"
// after
"liquid": "water"
Defensive patterns

Strategy: validation

Validate before calling

// Verify a typed content name exists (with and without the mod prefix).
boolean contentExists(ContentType ctype, String prefix, String name) {
    return Vars.content.getByName(ctype, prefix + name) != null
        || Vars.content.getByName(ctype, name) != null;
}

Prevention

When it happens

Trigger: A mod JSON references content of a concrete type (item/block/unit/etc.) by a name not found in that type's registry, with or without the current mod's prefix.

Common situations: Misspelled name, mod-name prefix mismatch, referenced content whose own JSON failed to parse, or load-order problems with dependencies.

Understand the failure class

Related errors


AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14). Data as JSON: /api/errors/ea9c2972b8243c33. Report an issue: GitHub.