{"record":{"id":"af4afcec304223b1","repo":"Anuken/Mindustry","slug":"unknown-save-version-are-you-trying-to-load-a","errorCode":null,"errorMessage":"Unknown save version: {}. Are you trying to load a save from a newer version?","messagePattern":"Unknown save version: (.+?)\\. Are you trying to load a save from a newer version\\?","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/io/MapIO.java","lineNumber":43,"sourceCode":"    public static boolean isImage(Fi file){\n        try(InputStream stream = file.read(32)){\n            for(int i1 : pngHeader){\n                if(stream.read() != i1){\n                    return false;\n                }\n            }\n            return true;\n        }catch(IOException e){\n            return false;\n        }\n    }\n\n    public static Map createMap(Fi file, boolean custom) throws IOException{\n        try(InputStream is = new InflaterInputStream(file.read(bufferSize)); CounterInputStream counter = new CounterInputStream(is); DataInputStream stream = new DataInputStream(counter)){\n            SaveIO.readHeader(stream);\n            int version = stream.readInt();\n            SaveVersion ver = SaveIO.getSaveWriter(version);\n            if(ver == null) throw new IOException(\"Unknown save version: \" + version + \". Are you trying to load a save from a newer version?\");\n            StringMap tags = new StringMap();\n            ver.readRegion(\"meta\", stream, counter, in -> tags.putAll(ver.readStringMap(in)));\n            return new Map(file, tags.getInt(\"width\"), tags.getInt(\"height\"), tags, custom, version, Version.build);\n        }\n    }\n\n    public static void writeMap(Fi file, Map map) throws IOException{\n        writeMap(file, map, true);\n    }\n\n    /** @param embed if true, assets will be embedded in the map - this is needed for external export. */\n    public static void writeMap(Fi file, Map map, boolean embed) throws IOException{\n        try{\n            SaveIO.write(file, new SaveOptions(){{\n                extraTags = map.tags;\n                embedAssets = embed;\n            }});\n        }catch(Exception e){","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/io/MapIO.java#L25-L61","documentation":"Thrown by MapIO.createMap when reading a map file: after reading the save header and version int, SaveIO.getSaveWriter(version) returns null (no registered SaveVersion for that number). The map's save format version is unknown to this build, implying it was written by a newer (or unrecognized) version. This is the map-import variant of the save-version guard.","triggerScenarios":"Importing/loading a map (.msav used as a map) whose embedded save version is not registered in SaveIO. Called from the editor import path (createMap).","commonSituations":"Importing a map made in a newer Mindustry build; map file from a modded/fork build using a different version scheme; corrupted version field.","solutions":["Update Mindustry to the build that authored the map.","Re-export the map from a compatible version.","Catch the IOException and inform the user the map version is unsupported."],"exampleFix":"// before\nMap map = MapIO.createMap(file, true);\n\n// after\ntry{\n    Map map = MapIO.createMap(file, true);\n}catch(IOException e){\n    ui.showErrorMessage(\"This map is from an unsupported save version.\");\n    Log.err(e);\n}","handlingStrategy":"try-catch","validationCode":"// sniff the save version before full parse if you can read the header\n// (SaveIO.getSaveWriter(version) == null signals unknown version)\nif(SaveIO.getSaveWriter(version) == null){\n    throw new IOException(\"Unsupported map save version: \" + version);\n}","typeGuard":null,"tryCatchPattern":"try{ Map map = MapIO.createMap(file, true); }catch(IOException e){ ui.showErrorMessage(\"Unsupported map version\"); Log.err(e); }","preventionTips":["Keep the game updated to read newer map versions.","Catch IOException at the import boundary.","Maintain maps in a compatible version when sharing.","Surface a clear 'newer version required' message to users."],"tags":["save","version","io","map","save-compat"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}