Anuken/Mindustry · error · IllegalArgumentException
Unknown unit stance name:
Error message
Unknown unit stance name:
What it means
Thrown by the UnitStance parser when data is a string but content.unitStance(name) returns null, i.e. no stance with that name is registered.
Source
Thrown at core/src/mindustry/mod/ContentParser.java:173
put(UnitCommand.class, (type, data) -> {
if(data.isString()){
var cmd = content.unitCommand(data.asString());
if(cmd != null){
return cmd;
}else{
throw new IllegalArgumentException("Unknown unit command name: " + data.asString());
}
}else{
throw new IllegalArgumentException("Unit commands must be strings.");
}
});
put(UnitStance.class, (type, data) -> {
if(data.isString()){
var cmd = content.unitStance(data.asString());
if(cmd != null){
return cmd;
}else{
throw new IllegalArgumentException("Unknown unit stance name: " + data.asString());
}
}else{
throw new IllegalArgumentException("Unit stances must be strings.");
}
});
put(BulletType.class, (type, data) -> {
if(data.isString()){
return field(Bullets.class, data);
}else if(data.isArray()){
return new MultiBulletType(parser.readValue(BulletType[].class, data));
}
Class<?> alternate = resolve(Strings.capitalize(data.getString("type", "basic")) + "BulletType", Object.class, false);
Class<?> bc = alternate == Object.class ? resolve(data.getString("type", ""), BasicBulletType.class) : alternate;
data.remove("type");
BulletType result = (BulletType)make(bc);
result.minfo.mod = currentMod;
readFields(result, data);
return result;View on GitHub (pinned to f695ad7e60)
Solutions
- Verify the stance name against registered unit stances.
- Confirm the game version supports that stance.
- Check mod load order if provided by another mod.
Example fix
// before "stance": "pursue" // after "stance": "pursueEnemy"
Defensive patterns
Strategy: validation
Validate before calling
// Verify a unit stance name is registered.
boolean stanceExists(String name) {
return Vars.content.unitStance(name) != null;
} Prevention
- Match stance names exactly as registered.
- Confirm version support for the stance.
- Check load order for cross-mod stances.
When it happens
Trigger: A mod JSON references a unit stance by a string name absent from the stance registry.
Common situations: Typo, stance not available in the current game version, or referencing content from an unloaded mod.
Related errors
- Unit stances must be strings.
- Attribute definitions must be objects, e.g. {heat: 10}
- Unknown status effect: '
- Unknown unit command name:
- Unit commands must be strings.
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/5a27323eec70c182.
Report an issue: GitHub.