Anuken/Mindustry · error · IOException
Invalid schematic: Too many blocks.
Error message
Invalid schematic: Too many blocks.
What it means
Thrown by Schematics.read when limitSchematicSize is enabled and the total block count read from the stream exceeds 128*128 (16384). This is the area-based cap complementing the dimension cap: even a small footprint schematic could in theory pack many blocks, so the total is bounded by the maximum grid area.
Source
Thrown at core/src/mindustry/game/Schematics.java:625
String[] labels = null;
//try to read the categories, but skip if it fails
try{
labels = JsonIO.read(String[].class, map.get("labels", "[]"));
}catch(Exception ignored){}
IntMap<Block> blocks = new IntMap<>();
int length = stream.readUnsignedByte();
for(int i = 0; i < length; i++){
String name = stream.readUTF();
Block block = Vars.content.getByName(ContentType.block, SaveFileReader.fallback.get(name, name));
blocks.put(i, block == null || block instanceof LegacyBlock ? Blocks.air : block);
}
int total = stream.readInt();
if(limitSchematicSize && total > 128 * 128) throw new IOException("Invalid schematic: Too many blocks.");
Reads read = new Reads(stream);
Seq<Stile> tiles = new Seq<>(total);
for(int i = 0; i < total; i++){
Block block = blocks.get(stream.readByte());
int position = stream.readInt();
Object config = ver == 0 ? mapConfig(block, stream.readInt(), position) : TypeIO.readObject(read, false, mapper);
byte rotation = stream.readByte();
if(block != Blocks.air){
tiles.add(new Stile(block, Point2.x(position), Point2.y(position), config, rotation));
}
}
Schematic out = new Schematic(tiles, map, width, height);
if(labels != null) out.labels.addAll(labels);
return out;
}View on GitHub (pinned to f695ad7e60)
Solutions
- Reduce the block count (split or simplify the schematic) to <= 16384 tiles.
- Set Schematics.limitSchematicSize = false if oversized schematics are intentional.
- Re-export from a valid editor selection that fits the cap.
Example fix
// before Schematic s = Schematics.read(input); // throws if total > 16384 // after Schematics.limitSchematicSize = false; Schematic s = Schematics.read(input);
Defensive patterns
Strategy: validation
Validate before calling
// if you know block count ahead of time
if(limitSchematicSize && total > 128*128){
ui.showErrorMessage("Too many blocks (max " + (128*128) + ")");
return;
} Try / catch
try{ Schematic s = Schematics.read(input); }catch(IOException e){ ui.showErrorMessage("Schematic has too many blocks"); } Prevention
- Keep block counts under 16384 for compatibility.
- Simplify or split dense schematics.
- Catch IOException at the import boundary.
When it happens
Trigger: A schematic whose 'total' field (stream.readInt()) is > 16384 with limitSchematicSize == true. Block count exceeding the 128x128 grid capacity.
Common situations: Densely packed schematics; schematics created by automation that exceed the block budget; combined/merged schematics that overflow.
Related errors
- Invalid schematic: Too large (max possible size is 128x128)
- Not a schematic file (missing header).
- Unknown version: {ver} (are you trying to load a schematic f
- Image is too large (maximum size is {MapResizeDialog.maxSize
- Unknown save version: {}. Are you trying to load a save from
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/b6d744897c907b49.
Report an issue: GitHub.