Anuken/Mindustry · error · IllegalArgumentException
Blocks cannot be larger than ${maxBlockSize}
Error message
Blocks cannot be larger than ${maxBlockSize} What it means
After readFields() populates a block from JSON, the parser verifies block.size does not exceed maxBlockSize (defined as 16 in Vars.java:103). A block larger than the engine maximum is rejected because rendering, edge caching (Edges.java uses maxBlockSize-sized arrays), and ConstructBlock allocation cannot accommodate it.
Source
Thrown at core/src/mindustry/mod/ContentParser.java:605
}else{
block = locate(ContentType.block, name);
}
}else{
block = make(resolve(value.getString("type", "Block"), allowPatching ? Block.class : null), mod + "-" + name);
}
currentContent = block;
read(() -> {
if(value.has("consumes") && value.get("consumes").isObject()){
readBlockConsumers(block, value.get("consumes"));
value.remove("consumes");
}
readFields(block, value, true);
if(block.size > maxBlockSize){
throw new IllegalArgumentException("Blocks cannot be larger than " + maxBlockSize);
}
//make block visible by default if there are requirements and no visibility set
if(value.has("requirements") && block.buildVisibility == BuildVisibility.hidden){
block.buildVisibility = BuildVisibility.shown;
}
});
return block;
},
ContentType.unit, (TypeParser<UnitType>)(mod, name, value) -> {
readBundle(ContentType.unit, name, value);
UnitType unit;
if(!allowPatching || locate(ContentType.unit, name) == null){
unit = make(resolve(value.getString("template", ""), UnitType.class), mod + "-" + name);
View on GitHub (pinned to f695ad7e60)
Solutions
- Set "size" to 16 or less in the block JSON.
- If a genuinely larger footprint is required, split the structure into multiple adjacent blocks.
- Do not attempt to raise Vars.maxBlockSize in a mod — it is final and baked into static arrays.
Example fix
// before "size": 24 // after "size": 12
Defensive patterns
Strategy: validation
Validate before calling
// Reject oversized blocks before parse.
if(value.has("size") && value.getInt("size", 0) > 16){
throw new IllegalStateException("Block size " + value.getInt("size") + " exceeds maxBlockSize 16");
} Prevention
- Treat 16 as a hard ceiling when designing multi-blocks.
- Document the limit in your mod authoring guide.
When it happens
Trigger: A mod block JSON sets "size" to an integer greater than 16 (e.g. a mega-factory at size 20). The check runs inside the block TypeParser's read() after fields are applied.
Common situations: Authoring oversized multi-block structures; assuming the limit is higher than 16; porting a mod from a fork that raised the cap.
Related errors
- Unknown consumption type: '${child.name}' for block '${block
- Unit '${name}' has an incorrect type. Types must be strings.
- Missing a valid 'block' in 'requirements'
- SectorPresets must have a sector number.
- Planet '${value.getString("planet")}' not found.
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/7a61e032a30d8f3b.
Report an issue: GitHub.