{"record":{"id":"57f9e4d471ace5db","repo":"Anuken/Mindustry","slug":"unknown-object-type","errorCode":null,"errorMessage":"Unknown object type: ","messagePattern":"Unknown object type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/io/TypeIO.java","lineNumber":269,"sourceCode":"                for(int i = 0; i < len; i ++) out[i] = new Vec2(read.f(), read.f());\n                yield out;\n            }\n            case 19 -> new Vec2(read.f(), read.f());\n            case 20 -> Team.all[read.ub()];\n            case 21 -> readInts(read);\n            case 22 -> {\n                if(!allowArrays) throw new RuntimeException(\"Nested arrays are not allowed\");\n                int len = read.i();\n                if(len > maxArraySize) throw new RuntimeException(\"Invalid array size: \" + len);\n\n                Object[] objs = new Object[len];\n                for(int i = 0; i < len; i++){\n                    objs[i] = readObject(read, box, mapper, safe, false);\n                }\n                yield objs;\n            }\n            case 23 -> content.unitCommand(read.us());\n            default -> throw new IllegalArgumentException(\"Unknown object type: \" + type);\n        };\n    }\n\n    public static void writeUiBuilder(Writes writes, NodeBuilder<?> node){\n        node.write(writes);\n    }\n\n    public static NodeBuilder<?> readUiBuilder(Reads reads){\n        return NodeBuilder.read(reads);\n    }\n\n    public static void writeMenuResult(Writes writes, MenuResult result){\n        writes.l(result.token);\n\n        writeString(writes, result.result);\n\n        writes.s(Math.min(MenuResult.maxTotalValues, result.values.size));\n        int i = 0;","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/io/TypeIO.java#L251-L287","documentation":"readObject()'s switch covers object type bytes 0–23. Any other type byte falls through to the default and throws IllegalArgumentException. There is no valid handler for that byte, meaning the stream is corrupt, from an incompatible version, or deliberately malformed.","triggerScenarios":"The first byte of an object read is outside the range 0..23.","commonSituations":"Client/server version mismatch (a newer protocol wrote a type the reader does not know); stream desync/corruption; packet fuzzing.","solutions":["Ensure both peers run the same game and mod versions.","Server: catch IllegalArgumentException and kick the sender.","If you added a new type in a fork, extend the switch on both sides consistently."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { TypeIO.readObject(read); }\ncatch(IllegalArgumentException e){ Log.err(\"Unknown object type in packet\", e); con.kick(\"Protocol mismatch.\"); }","preventionTips":["Keep client and server on identical game and mod builds.","Treat unknown-type errors as a desync, not a transient fault.","If you fork the protocol, extend the type switch on both ends."],"tags":["network","deserialization","version-mismatch","protocol"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}