Anuken/Mindustry · error · IllegalArgumentException
Attribute definitions must be objects, e.g. {heat: 10}
Error message
Attribute definitions must be objects, e.g. {heat: 10} What it means
Thrown by the Attributes parser in ContentParser when the JSON value for an Attributes-typed field is not a JSON object. Attributes is a name->float map (e.g. {heat: 10}), so strings, numbers, or arrays are invalid.
Source
Thrown at core/src/mindustry/mod/ContentParser.java:96
}
Class<? extends Effect> bc = resolve(data.getString("type", ""), ParticleEffect.class);
data.remove("type");
Effect result = make(bc);
readFields(result, data);
return result;
});
put(Sortf.class, (type, data) -> field(UnitSorts.class, data));
put(Interp.class, (type, data) -> field(Interp.class, data));
put(Blending.class, (type, data) -> field(Blending.class, data));
put(CacheLayer.class, (type, data) -> field(CacheLayer.class, data));
put(Attribute.class, (type, data) -> {
String attr = data.asString();
if(Attribute.exists(attr)) return Attribute.get(attr);
return Attribute.add(attr);
});
put(Attributes.class, (type, data) -> {
if(!data.isObject()){
throw new IllegalArgumentException("Attribute definitions must be objects, e.g. {heat: 10}");
}
Attributes attr = new Attributes();
for(var child : data){
Attribute value = Attribute.exists(child.name) ? Attribute.get(child.name) : Attribute.add(child.name);
attr.set(value, child.asFloat());
}
return attr;
});
put(BuildVisibility.class, (type, data) -> field(BuildVisibility.class, data));
put(Schematic.class, (type, data) -> {
Object result = fieldOpt(Loadouts.class, data);
if(result != null){
return result;
}else{
String str = data.asString();
if(str.startsWith(Vars.schematicBaseStart)){
return Schematics.readBase64(str);
}else{View on GitHub (pinned to f695ad7e60)
Solutions
- Rewrite the value as a JSON object mapping attribute names to floats.
- Verify each attribute name either exists or will be auto-added via Attribute.add.
- Distinguish Attributes (the map) from a single Attribute reference (which accepts a string).
Example fix
// before
"attributes": "heat"
// after
"attributes": { "heat": 10 } Defensive patterns
Strategy: type-guard
Type guard
// Guard: Attributes must be a JSON object (map of name->float).
boolean validAttributes(JsonValue v) {
return v.isObject();
} Prevention
- Author attributes as { name: value } objects, never bare strings/numbers.
- Cross-check attribute names against the Attribute registry.
- Use a JSON schema/linter for mod content files.
When it happens
Trigger: A mod JSON block sets an `attributes` field (or any Attributes-typed field) to a non-object value such as "heat", 10, or [1,2].
Common situations: Mod authors copy the wrong example, pass a single attribute name string instead of a map, or confuse Attributes with a single Attribute.
Related errors
- Unknown status effect: '
- Unknown unit command name:
- Unit commands must be strings.
- Unknown unit stance name:
- Unit stances must be strings.
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/920caedefe8cd663.
Report an issue: GitHub.