egametang/ET · error · IOException
Unsupported compression type {compressionType}
Error message
Unsupported compression type {compressionType} What it means
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.
Source
Thrown at Packages/cn.etetet.hybridclr/Scripts/Editor/Share/3rds/UnityFS/BundleFileReader.cs:115
using (var compressedStream = new MemoryStream(compressedBytes))
{
ComparessHelper.Decompress7Zip(compressedStream, uncompressedStream, m_Header.compressedBlocksInfoSize, m_Header.uncompressedBlocksInfoSize);
}
return uncompressedStream.ReadAllBytes();
}
case CompressionType.Lz4:
case CompressionType.Lz4HC:
{
var uncompressedBytes = new byte[uncompressedSize];
var numWrite = LZ4Codec.Decode(compressedBytes, 0, compressedBytes.Length, uncompressedBytes, 0, uncompressedBytes.Length, true);
if (numWrite != uncompressedSize)
{
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
}
return uncompressedBytes;
}
default:
throw new IOException($"Unsupported compression type {compressionType}");
}
}
private void ReadMetadata(EndianBinaryReader reader)
{
byte[] compressMetadataBytes = ReadBlocksInfoAndDirectoryMetadataUnCompressedBytes(reader);
MemoryStream metadataStream = new MemoryStream(DecompressBytes((CompressionType)(m_Header.flags & ArchiveFlags.CompressionTypeMask), compressMetadataBytes, m_Header.uncompressedBlocksInfoSize));
using (var blocksInfoReader = new EndianBinaryReader(metadataStream))
{
var uncompressedDataHash = blocksInfoReader.ReadBytes(16);
var blocksInfoCount = blocksInfoReader.ReadInt32();
m_BlocksInfo = new StorageBlock[blocksInfoCount];
for (int i = 0; i < blocksInfoCount; i++)
{
m_BlocksInfo[i] = new StorageBlock
{
uncompressedSize = blocksInfoReader.ReadUInt32(),
compressedSize = blocksInfoReader.ReadUInt32(),View on GitHub (pinned to 5cab01f7a8)
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.
Defensive patterns
Strategy: validation
Validate before calling
CompressionType ct = (CompressionType)(flags & CompressionTypeMask);
if (ct != CompressionType.None && ct != CompressionType.Lzma && ct != CompressionType.Lz4 && ct != CompressionType.Lz4HC)
throw new NotSupportedException($"unsupported compression {ct}; rebuild bundle with Lz4/Lz4HC"); Try / catch
try { reader.Load(...); }
catch (IOException e) when (e.Message.Contains("Unsupported compression type"))
{ Log.Error($"unsupported compression in bundle: {e.Message}"); /* rebuild with supported codec */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Lz4 decompression error, write {numWrite} bytes but expected
- too fig file
- btenv not found key: {key} {typeof(T).FullName}
- 不能把{value.GetType()}转换为{typeof (T)}
- condition root child count error: {node.Children.Count}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/c7c0e2b788d2ab1f.
Report an issue: GitHub.