Anuken/Mindustry · error · IOException

Invalid schematic: Too large (max possible size is 128x128)

Error message

Invalid schematic: Too large (max possible size is 128x128)

What it means

Thrown by Schematics.read when limitSchematicSize is enabled and the schematic's declared width or height exceeds 128 tiles. The dimensions are read right after the version byte inside the inflated data stream. The 128 cap bounds schematic memory and network payload size. limitSchematicSize is a runtime toggle (true by default) that can be disabled to allow oversized schematics.

Source

Thrown at core/src/mindustry/game/Schematics.java:584

        s.file = file;
        return s;
    }

    public static Schematic read(InputStream input) throws IOException{
        for(byte b : header){
            if(input.read() != b){
                throw new IOException("Not a schematic file (missing header).");
            }
        }

        int ver = input.read();

        if(ver > version) throw new IOException("Unknown version: " + ver + " (are you trying to load a schematic from a newer version of the game?)");

        try(DataInputStream stream = new DataInputStream(new InflaterInputStream(input))){
            short width = stream.readShort(), height = stream.readShort();

            if(limitSchematicSize && (width > 128 || height > 128)) throw new IOException("Invalid schematic: Too large (max possible size is 128x128)");

            StringMap map = new StringMap();
            int tags = stream.readUnsignedByte();
            for(int i = 0; i < tags; i++){
                map.put(stream.readUTF(), stream.readUTF());
            }

            ContentMapper mapper = null;

            //set up content mapping if found; this should not fail
            if(map.containsKey("contentMap")){
                IntMap<ObjectIntMap<String>> nameMap = JsonIO.json.fromJson(IntMap.class, ObjectIntMap.class, map.get("contentMap", "{}"));
                IntMap<IntMap<Content>> contentMap = new IntMap<>();
                for(var entry : nameMap){
                    var inner = new IntMap<Content>();
                    contentMap.put(entry.key, inner);
                    for(var ce : entry.value){
                        inner.put(ce.value, content.getByName(ContentType.all[entry.key], ce.key));

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Split the large schematic into smaller pieces (each <= 128 in both dimensions).
  2. If you intentionally need oversized schematics, set Schematics.limitSchematicSize = false before reading (note: higher memory/network cost).
  3. Re-create the schematic within editor selection limits.

Example fix

// before
Schematic s = Schematics.read(input); // throws if >128

// after (only if you accept the cost)
Schematics.limitSchematicSize = false;
Schematic s = Schematics.read(input);
Defensive patterns

Strategy: validation

Validate before calling

// if you know dimensions ahead of time, gate before reading
if(limitSchematicSize && (width > 128 || height > 128)){
    // split or disable limit intentionally
    Schematics.limitSchematicSize = false; // only if accepted
}

Try / catch

try{ Schematic s = Schematics.read(input); }catch(IOException e){ ui.showErrorMessage("Schematic too large (max 128x128)"); }

Prevention

When it happens

Trigger: A schematic whose width or height (read via stream.readShort()) is > 128, with limitSchematicSize == true. Typically hand-crafted or externally-produced schematics that exceed the cap.

Common situations: Loading a very large schematic (e.g. a full-base copy); schematics produced by tools/mods that don't respect the 128 limit; legacy schematics from when the cap was different.

Related errors


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