Perfare/Il2CppDumper · error · Exception
Invalid compressed integer format
Error message
Invalid compressed integer format
What it means
Thrown by ReadCompressedUInt32 when the leading byte's high bits do not encode one of the valid compressed-integer layouts (1-byte <=0x7F, 2-byte 0x80..0xBF, 4-byte 0xC0..0xF7, special 0xF8/0xF9 forms). The byte stream is not a valid .NET-metadata-style compressed integer.
Solutions
- Confirm the metadata file version matches one the dumper supports (16-31) and that no offsets were hand-patched.
- Check that the reader position is exactly at the start of a compressed-integer field before the call.
- Re-extract global-metadata.dat from the APK/IPA; a corrupted blob produces bad leading bytes.
- If the game uses a newer Unity/il2cpp version, update Il2CppDumper or dump with a matching tool version.
Defensive patterns
Strategy: try-catch
Validate before calling
// Compressed int leading-byte classes: // b <= 0x7F (1B), 0x80-0xBF (2B), 0xC0-0xF7 (4B), 0xF8/0xF9 special bool LooksLikeCompressedInt(byte lead) => lead <= 0xF7 && lead >= 0x80 || lead <= 0x7F;
Try / catch
try { uint v = reader.ReadCompressedUInt32(); }
catch (Exception ex) when (ex.Message == "Invalid compressed integer format") { /* reader mispositioned or corrupt blob */ } Prevention
- Ensure the metadata version is supported before parsing tables.
- Never hand-patch metadata offsets; regenerate or re-extract instead.
- Verify reader position against the header's table offsets before reads.
When it happens
Trigger: Calling reader.ReadCompressedUInt32() when the reader is mispositioned in metadata tables (string/array data instead of a compressed integer), or reading a metadata blob whose encoding was corrupted.
Common situations: Version drift between the dumper's expected metadata layout and the actual file (unsupported game version), wrong offsets after a corrupted header, or manually patched metadata blobs.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- ERROR: Metadata file supplied is not valid metadata file.
- ERROR: Metadata file supplied is not a supported version
AI-assisted analysis of Perfare/Il2CppDumper@4741d46ba9 (2026-09-11).
Data as JSON: /api/errors/afea74daeed4a81c.
Report an issue: GitHub.
Appendix: source
Thrown at Il2CppDumper/Extensions/BinaryReaderExtensions.cs:80
}
else if (read == 0xF0)
{
// 5 bytes written, we had a really large int32!
val = reader.ReadUInt32();
}
else if (read == 0xFE)
{
// Special encoding for Int32.MaxValue
val = uint.MaxValue - 1;
}
else if (read == 0xFF)
{
// Yes we treat UInt32.MaxValue (and Int32.MinValue, see ReadCompressedInt32) specially
val = uint.MaxValue;
}
else
{
throw new Exception("Invalid compressed integer format");
}
return val;
}
public static int ReadCompressedInt32(this BinaryReader reader)
{
var encoded = reader.ReadCompressedUInt32();
// -UINT32_MAX can't be represted safely in an int32_t, so we treat it specially
if (encoded == uint.MaxValue)
return int.MinValue;
bool isNegative = (encoded & 1) != 0;
encoded >>= 1;
if (isNegative)
return -(int)(encoded + 1);
return (int)encoded;View on GitHub (pinned to 4741d46ba9)