Anuken/Mindustry · error · IllegalArgumentException
Unknown team: ${data.asString()}
Error message
Unknown team: ${data.asString()} What it means
Thrown by the Team parser when data is a number whose value is >= Team.all.length. Numeric team IDs must index into the allocated team array; an ID past the end is invalid.
Source
Thrown at core/src/mindustry/mod/ContentParser.java:393
var consume = make(oc);
readFields(consume, data);
return consume;
});
put(ConsumeLiquidBase.class, (type, data) -> {
var oc = resolve(data.getString("type", ""), ConsumeLiquidBase.class);
data.remove("type");
var consume = make(oc);
readFields(consume, data);
return consume;
});
put(Team.class, (type, data) -> {
if(data.isString()){
Team out = Structs.find(Team.baseTeams, t -> t.name.equals(data.asString()));
if(out == null) throw new IllegalArgumentException("Unknown team: " + data.asString());
return out;
}else if(data.isNumber()){
if(data.asInt() >= Team.all.length || data.asInt() < 0){
throw new IllegalArgumentException("Unknown team: " + data.asString());
}
return Team.get(data.asInt());
}else{
throw new IllegalArgumentException("Unknown team: " + data.asString() + ". Team must either be a string or a number.");
}
});
}};
/** Stores things that need to be parsed fully, e.g. reading fields of content.
* This is done to accommodate binding of content names first.*/
private Seq<Runnable> reads = new Seq<>();
private Seq<Runnable> postreads = new Seq<>();
private ObjectSet<Object> toBeParsed = new ObjectSet<>();
@Nullable LoadedMod currentMod;
@Nullable Content currentContent;
@Nullable Fi currentFile;
private Json parser = new Json(){View on GitHub (pinned to f695ad7e60)
Solutions
- Use a team index within [0, Team.all.length).
- Prefer a base team name string for built-in teams.
- If a custom high ID is required, ensure enough teams are allocated first (mod/server config).
Example fix
// before "team": 999 // after "team": 1 // or "team": "crux"
Defensive patterns
Strategy: validation
Validate before calling
// Verify a numeric team ID is within the allocated range.
boolean validTeamId(int id) {
return id >= 0 && id < Team.all.length;
} Prevention
- Keep team IDs within [0, Team.all.length).
- Prefer base team name strings for built-in teams.
- Allocate enough teams before referencing high IDs.
When it happens
Trigger: A mod JSON team field is a number larger than or equal to the size of Team.all (too many teams allocated / version with fewer teams).
Common situations: Hard-coding a high team ID that exceeds the current game's team allocation, or assuming a team count from a different version/mod.
Related errors
- Unknown team:
- Unknown team: ${data.asString()}. Team must either be a stri
- Team field missing.
- Attribute definitions must be objects, e.g. {heat: 10}
- Unknown status effect: '
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/9f043d27c42dd5db.
Report an issue: GitHub.