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

  1. Set "size" to 16 or less in the block JSON.
  2. If a genuinely larger footprint is required, split the structure into multiple adjacent blocks.
  3. 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

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


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