{"record":{"id":"c7c0e2b788d2ab1f","repo":"egametang/ET","slug":"unsupported-compression-type-compressiontype","errorCode":null,"errorMessage":"Unsupported compression type {compressionType}","messagePattern":"Unsupported compression type (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.hybridclr/Scripts/Editor/Share/3rds/UnityFS/BundleFileReader.cs","lineNumber":115,"sourceCode":"                        using (var compressedStream = new MemoryStream(compressedBytes))\n                        {\n                            ComparessHelper.Decompress7Zip(compressedStream, uncompressedStream, m_Header.compressedBlocksInfoSize, m_Header.uncompressedBlocksInfoSize);\n                        }\n                        return uncompressedStream.ReadAllBytes();\n                    }\n                case CompressionType.Lz4:\n                case CompressionType.Lz4HC:\n                    {\n                        var uncompressedBytes = new byte[uncompressedSize];\n                        var numWrite = LZ4Codec.Decode(compressedBytes, 0, compressedBytes.Length, uncompressedBytes, 0, uncompressedBytes.Length, true);\n                        if (numWrite != uncompressedSize)\n                        {\n                            throw new IOException($\"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes\");\n                        }\n                        return uncompressedBytes;\n                    }\n                default:\n                    throw new IOException($\"Unsupported compression type {compressionType}\");\n            }\n        }\n\n        private void ReadMetadata(EndianBinaryReader reader)\n        {\n            byte[] compressMetadataBytes = ReadBlocksInfoAndDirectoryMetadataUnCompressedBytes(reader);\n            MemoryStream metadataStream = new MemoryStream(DecompressBytes((CompressionType)(m_Header.flags & ArchiveFlags.CompressionTypeMask), compressMetadataBytes, m_Header.uncompressedBlocksInfoSize));\n            using (var blocksInfoReader = new EndianBinaryReader(metadataStream))\n            {\n                var uncompressedDataHash = blocksInfoReader.ReadBytes(16);\n                var blocksInfoCount = blocksInfoReader.ReadInt32();\n                m_BlocksInfo = new StorageBlock[blocksInfoCount];\n                for (int i = 0; i < blocksInfoCount; i++)\n                {\n                    m_BlocksInfo[i] = new StorageBlock\n                    {\n                        uncompressedSize = blocksInfoReader.ReadUInt32(),\n                        compressedSize = blocksInfoReader.ReadUInt32(),","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.hybridclr/Scripts/Editor/Share/3rds/UnityFS/BundleFileReader.cs#L97-L133","documentation":"BundleFileReader.DecompressBytes (line 115) throws IOException for a CompressionType value outside None/Lzma/Lz4/Lz4HC. The reader does not know how to decompress that block, so it refuses. This typically signals a newer Unity bundle format with a compression flag this reader predates.","triggerScenarios":"Loading a UnityFS bundle whose block/metadata flags encode a compression type not handled (e.g. a newer Unity LZSS/zstd variant), or a malformed flags field yielding a bogus CompressionType after masking.","commonSituations":"Opening bundles built by a newer Unity version than the reader supports, a corrupted flags header producing an unknown enum value, or a custom compression the toolchain never registered.","solutions":["Rebuild/export the bundle with a compression type this reader supports (None/Lz4/Lz4HC/Lzma).","Use a Unity/editor version whose BundleFileReader understands the bundle's compression flag.","If the flags field is corrupted, re-fetch/rebuild the bundle.","Extend the switch with the new compression type if you must support it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"CompressionType ct = (CompressionType)(flags & CompressionTypeMask);\nif (ct != CompressionType.None && ct != CompressionType.Lzma && ct != CompressionType.Lz4 && ct != CompressionType.Lz4HC)\n    throw new NotSupportedException($\"unsupported compression {ct}; rebuild bundle with Lz4/Lz4HC\");","typeGuard":null,"tryCatchPattern":"try { reader.Load(...); }\ncatch (IOException e) when (e.Message.Contains(\"Unsupported compression type\"))\n{ Log.Error($\"unsupported compression in bundle: {e.Message}\"); /* rebuild with supported codec */ }","preventionTips":["Build bundles with a supported compression (Lz4/Lz4HC/None).","Match the editor/reader Unity version to the bundle's Unity version.","Validate the flags/compression field before decompressing."],"tags":["unity","assetbundle","compression","editor","version-compat"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}