{"record":{"id":"733fb23d387e5a00","repo":"Perfare/Il2CppDumper","slug":"error-il2cpp-file-not-supported","errorCode":null,"errorMessage":"ERROR: il2cpp file not supported.","messagePattern":"ERROR: il2cpp file not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"Il2CppDumper/Program.cs","lineNumber":133,"sourceCode":"        {\n            Console.WriteLine($\"usage: {AppDomain.CurrentDomain.FriendlyName} <executable-file> <global-metadata> <output-directory>\");\n        }\n\n        private static bool Init(string il2cppPath, string metadataPath, out Metadata metadata, out Il2Cpp il2Cpp)\n        {\n            Console.WriteLine(\"Initializing metadata...\");\n            var metadataBytes = File.ReadAllBytes(metadataPath);\n            metadata = new Metadata(new MemoryStream(metadataBytes));\n            Console.WriteLine($\"Metadata Version: {metadata.Version}\");\n\n            Console.WriteLine(\"Initializing il2cpp file...\");\n            var il2cppBytes = File.ReadAllBytes(il2cppPath);\n            var il2cppMagic = BitConverter.ToUInt32(il2cppBytes, 0);\n            var il2CppMemory = new MemoryStream(il2cppBytes);\n            switch (il2cppMagic)\n            {\n                default:\n                    throw new NotSupportedException(\"ERROR: il2cpp file not supported.\");\n                case 0x6D736100:\n                    var web = new WebAssembly(il2CppMemory);\n                    il2Cpp = web.CreateMemory();\n                    break;\n                case 0x304F534E:\n                    var nso = new NSO(il2CppMemory);\n                    il2Cpp = nso.UnCompress();\n                    break;\n                case 0x905A4D: //PE\n                    il2Cpp = new PE(il2CppMemory);\n                    break;\n                case 0x464c457f: //ELF\n                    if (il2cppBytes[4] == 2) //ELF64\n                    {\n                        il2Cpp = new Elf64(il2CppMemory);\n                    }\n                    else\n                    {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/Perfare/Il2CppDumper/blob/4741d46ba9cd6159c5d853eb9d6fc48b4bfa2b1a/Il2CppDumper/Program.cs#L115-L151","documentation":"Thrown in Init when the first 4 bytes (magic) of the il2cpp binary do not match any supported format: PE never reaches here (it validates internally), WASM 0x6D736100, NSO 0x304F534E, ELF, etc. are handled, anything else is rejected. The file is not a recognized executable format.","triggerScenarios":"Running Il2CppDumper with a binary whose leading uint32 is not one of the switch cases (0x6D736100 WASM, 0x304F534E NSO, 0x464C457F ELF, 0x905A4D PE path handled earlier, etc.) — e.g. Mach-O, XELF variants, or text/garbage files.","commonSituations":"Feeding the dumper an iOS Mach-O binary in a build that expects the ELF/PE switch (depends on the switch's full case set), passing a config or archive file as the binary, or encrypted/packed binaries whose magic was overwritten by a protector.","solutions":["Check the first 4 bytes of the binary to identify its actual format.","If the binary is Mach-O (iOS), convert it or use an Il2CppDumper build/fork with Mach-O support.","If a packer overwrote the magic, dump/unwrap the binary from memory first (e.g. via a dumped memory region that restores the original header).","Ensure the first CLI argument is the il2cpp binary itself, not a zip/archive or config file."],"exampleFix":"// before\nIl2CppDumper.exe config.json global-metadata.dat // magic is garbage\n// after\nIl2CppDumper.exe GameAssembly.dll global-metadata.dat","handlingStrategy":"validation","validationCode":"byte[] b = File.ReadAllBytes(binaryPath);\nuint magic = BitConverter.ToUInt32(b, 0);\nbool known = magic == 0x905A4D || magic == 0x464C457F || magic == 0x304F534E || magic == 0x6D736100; // PE/ELF/NSO/WASM","typeGuard":"static bool IsKnownIl2CppBinary(byte[] b) => b.Length >= 4 && new HashSet<uint>{0x905A4D,0x464C457F,0x304F534E,0x6D736100}.Contains(BitConverter.ToUInt32(b,0));","tryCatchPattern":"try { Init(...); }\ncatch (NotSupportedException ex) when (ex.Message == \"ERROR: il2cpp file not supported.\") { /* identify format and pick a matching tool */ }","preventionTips":["Identify the binary format from its first 4 bytes before dumping.","For Mach-O iOS binaries use a tool/fork with Mach-O support.","If packed, dump the binary from process memory to restore the real header."],"tags":["executable-format","magic-number","unsupported-format"],"backgroundTag":"unsupported-operation","analyzedSha":"4741d46ba9cd6159c5d853eb9d6fc48b4bfa2b1a","analyzedAt":"2026-09-11T16:52:42.117Z","contentChangedAt":"2026-09-11T16:52:42.117Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}