{"record":{"id":"86972eb7a736d672","repo":"Anuken/Mindustry","slug":"invalid-schematic-too-large-max-possible-size-is","errorCode":null,"errorMessage":"Invalid schematic: Too large (max possible size is 128x128)","messagePattern":"Invalid schematic: Too large \\(max possible size is 128x128\\)","errorType":"validation","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/game/Schematics.java","lineNumber":584,"sourceCode":"        s.file = file;\n        return s;\n    }\n\n    public static Schematic read(InputStream input) throws IOException{\n        for(byte b : header){\n            if(input.read() != b){\n                throw new IOException(\"Not a schematic file (missing header).\");\n            }\n        }\n\n        int ver = input.read();\n\n        if(ver > version) throw new IOException(\"Unknown version: \" + ver + \" (are you trying to load a schematic from a newer version of the game?)\");\n\n        try(DataInputStream stream = new DataInputStream(new InflaterInputStream(input))){\n            short width = stream.readShort(), height = stream.readShort();\n\n            if(limitSchematicSize && (width > 128 || height > 128)) throw new IOException(\"Invalid schematic: Too large (max possible size is 128x128)\");\n\n            StringMap map = new StringMap();\n            int tags = stream.readUnsignedByte();\n            for(int i = 0; i < tags; i++){\n                map.put(stream.readUTF(), stream.readUTF());\n            }\n\n            ContentMapper mapper = null;\n\n            //set up content mapping if found; this should not fail\n            if(map.containsKey(\"contentMap\")){\n                IntMap<ObjectIntMap<String>> nameMap = JsonIO.json.fromJson(IntMap.class, ObjectIntMap.class, map.get(\"contentMap\", \"{}\"));\n                IntMap<IntMap<Content>> contentMap = new IntMap<>();\n                for(var entry : nameMap){\n                    var inner = new IntMap<Content>();\n                    contentMap.put(entry.key, inner);\n                    for(var ce : entry.value){\n                        inner.put(ce.value, content.getByName(ContentType.all[entry.key], ce.key));","sourceCodeStart":566,"sourceCodeEnd":602,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/game/Schematics.java#L566-L602","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Split the large schematic into smaller pieces (each <= 128 in both dimensions).","If you intentionally need oversized schematics, set Schematics.limitSchematicSize = false before reading (note: higher memory/network cost).","Re-create the schematic within editor selection limits."],"exampleFix":"// before\nSchematic s = Schematics.read(input); // throws if >128\n\n// after (only if you accept the cost)\nSchematics.limitSchematicSize = false;\nSchematic s = Schematics.read(input);","handlingStrategy":"validation","validationCode":"// if you know dimensions ahead of time, gate before reading\nif(limitSchematicSize && (width > 128 || height > 128)){\n    // split or disable limit intentionally\n    Schematics.limitSchematicSize = false; // only if accepted\n}","typeGuard":null,"tryCatchPattern":"try{ Schematic s = Schematics.read(input); }catch(IOException e){ ui.showErrorMessage(\"Schematic too large (max 128x128)\"); }","preventionTips":["Keep schematics within 128x128 for compatibility.","Split large layouts into multiple schematics.","Only disable limitSchematicSize with a clear reason and memory budget."],"tags":["schematic","limits","io","config"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}