{"record":{"id":"c4a2bf97772102e2","repo":"Anuken/Mindustry","slug":"invalid-asset-type-id-you-are-likely-loading","errorCode":null,"errorMessage":"Invalid asset type ID: {}. You are likely loading trying to load a save from a newer version of the game, possibly a beta.","messagePattern":"Invalid asset type ID: (.+?)\\. You are likely loading trying to load a save from a newer version of the game, possibly a beta\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/io/SaveVersion.java","lineNumber":552,"sourceCode":"\n        return entityMapping;\n    }\n\n    public void readEntities(DataInput stream) throws IOException{\n        var mapping = readEntityMapping(stream);\n        readTeamBlocks(stream);\n        readWorldEntities(stream, mapping);\n    }\n\n    public void readDataPatches(DataInput stream, SaveReadState saveState) throws IOException{\n        stream.readInt(); //version - ignored for now\n\n        int total = stream.readInt();\n        Seq<DataAsset> assets = new Seq<>(total);\n\n        for(int i = 0; i < total; i++){\n            byte typeId = stream.readByte();\n            if(typeId < 0 || typeId >= DataAssetType.all.length) throw new IOException(\"Invalid asset type ID: \" + typeId + \". You are likely loading trying to load a save from a newer version of the game, possibly a beta.\");\n\n            String path = stream.readUTF();\n            boolean embedded = stream.readBoolean();\n            var type = DataAssetType.all[typeId];\n            var asset = type.create();\n\n            asset.setPath(path);\n\n            if(embedded){\n                asset.read(stream);\n            }else{\n                byte[] hash = new byte[32];\n                stream.readFully(hash);\n                asset.setHash(hash);\n\n                if(!asset.isCached()){\n                    //TODO: log this when loading a save\n                    Log.warn(\"Asset @: cache file not found.\", asset.path);","sourceCodeStart":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/io/SaveVersion.java#L534-L570","documentation":"In SaveVersion.readDataPatches (v11+ saves), each embedded asset is prefixed by a typeId byte that indexes DataAssetType.all. If the byte is negative or >= the registered array length, the asset type is unknown to this build and the save cannot be patched. The message explicitly suggests a newer-version save (often a beta).","triggerScenarios":"readDataPatches iterates total assets; a typeId byte written by a newer build whose DataAssetType.all has more entries than the loading build's array. Only fires on the patches region, which is read for version >= 12 (and synthesized for < 11).","commonSituations":"Loading a beta/bleeding-edge save on a stable build; downgrading across an asset-type schema change; mod that extended DataAssetType and the save was made with it but loaded without.","solutions":["Upgrade the loading build to match (or exceed) the build that wrote the save; DataAssetType.all is populated at content init and grows with version.","If developing, register the missing DataAssetType before load.","Disable loading of saves known to be from a newer branch (gate on SaveMeta build tag)."],"exampleFix":"// before\nSaveIO.load(file); // Invalid asset type ID\n\n// after\nSaveMeta meta = SaveIO.getMeta(SaveIO.fileFor(slot));\nif (meta.build > Version.build) {\n    ui.showInfo(\"Save is from a newer build (@); cannot load.\", meta.build);\n} else {\n    SaveIO.load(file);\n}","handlingStrategy":"validation","validationCode":"SaveMeta meta = SaveIO.getMeta(file);\nif (meta.build > Version.build) {\n    throw new IllegalStateException(\"Save build \" + meta.build + \" newer than current \" + Version.build);\n}","typeGuard":"null","tryCatchPattern":"try {\n    SaveIO.load(file);\n} catch (SaveException e) {\n    if (String.valueOf(e.getCause()).contains(\"Invalid asset type ID\")) {\n        // newer-version save; inform user\n    }\n}","preventionTips":["Compare SaveMeta.build to the local Version.build before loading.","Register all DataAssetTypes at content init when developing mods.","Avoid loading beta saves on stable builds."],"tags":["save-io","version-mismatch","data-patches","deserialization"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}