Anuken/Mindustry · error · IllegalArgumentException

Unknown objective content:

Error message

Unknown objective content: 

What it means

Thrown by the Objective parser when data is a string but locateAny(name) returns null. A string objective is treated as a Research reference to an UnlockableContent; if no such content exists, it is rejected.

Source

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

            var field = fieldOpt(Musics.class, data);

            if(headless) return new Music(); //no reason to fetch on a server

            //try grabbing it from the asset manager directly (relevant for data patches)
            if(field == null) field = Core.assets.getOrNull(data.asString() + ".ogg", Music.class);
            if(field == null) field = Core.assets.getOrNull(data.asString() + ".mp3", Music.class);
            if(field == null) field = Core.assets.getOrNull(data.asString(), Music.class);

            if(!allowAssetLoading && field == null){
                warn("Music not found: @", data.asString());
                return new Music();
            }
            return field != null ? field : Vars.tree.loadMusic(data.asString());
        });
        put(Objectives.Objective.class, (type, data) -> {
            if(data.isString()){
                var cont = locateAny(data.asString());
                if(cont == null) throw new IllegalArgumentException("Unknown objective content: " + data.asString());
                return new Research((UnlockableContent)cont);
            }
            var oc = resolve(data.getString("type", ""), SectorComplete.class);
            data.remove("type");
            Objectives.Objective obj = make(oc);
            readFields(obj, data);
            return obj;
        });
        put(Ability.class, (type, data) -> {
            Class<? extends Ability> oc = resolve(data.getString("type", ""));
            data.remove("type");
            Ability obj = make(oc);
            readFields(obj, data);
            return obj;
        });
        put(Weapon.class, (type, data) -> {
            var oc = resolve(data.getString("type", ""), Weapon.class);
            data.remove("type");

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Verify the referenced content name exists and is spelled correctly.
  2. Ensure the referenced content's file parsed without errors and loads before this objective resolves.
  3. If you meant a sector-complete objective, use the object form with type: SectorComplete instead of a string.

Example fix

// before
"objectives": [ "copper" ]
// after
"objectives": [ "copper" ]   // valid only if 'copper' exists; otherwise fix spelling/type
Defensive patterns

Strategy: validation

Validate before calling

// Verify referenced content exists across all types before using as an objective.
boolean objectiveContentExists(String name) {
    return locateAny(name) != null; // mirror ContentParser.locateAny
}

Prevention

When it happens

Trigger: A mod JSON defines an objective as a bare string referencing content that is not registered (e.g. research prerequisite pointing to a non-existent item/block).

Common situations: Typo in the content name, content defined in a mod that failed to parse, or referencing content that loads later.

Related errors


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