Tencent/tinker · error · IllegalArgumentException
unknown section type: ${type}
Error message
unknown section type: ${type} What it means
Thrown by the switch-based getSection(short type) in TableOfContents when a map_list entry's type code is not one of the known SECTION_TYPE_* constants (header, stringIds, typeIds, protoIds, fieldIds, methodIds, classDefs, mapList, typeLists, annotationSetRefs, annotations, encodedArrays, annotationsDirectories). The map list is the dex's self-describing section index; an unknown code means unrecognized or corrupt input.
Source
Thrown at third-party/aosp-dexutils/src/main/java/com/tencent/tinker/android/dex/TableOfContents.java:150
return codes;
}
case SECTION_TYPE_STRINGDATAS: {
return stringDatas;
}
case SECTION_TYPE_DEBUGINFOS: {
return debugInfos;
}
case SECTION_TYPE_ANNOTATIONS: {
return annotations;
}
case SECTION_TYPE_ENCODEDARRAYS: {
return encodedArrays;
}
case SECTION_TYPE_ANNOTATIONSDIRECTORIES: {
return annotationsDirectories;
}
default: {
throw new IllegalArgumentException("unknown section type: " + type);
}
}
}
public void readFrom(Dex dex) throws IOException {
readHeader(dex.openSection(header));
// special case, since mapList.byteCount is available only after
// computeSizesFromOffsets() was invoked, so here we can't use
// dex.openSection(mapList) to get dex section. Or
// an {@code java.nio.BufferUnderflowException} will be thrown.
readMap(dex.openSection(mapList.off));
computeSizesFromOffsets();
}
private void readHeader(Dex.Section headerIn) throws UnsupportedEncodingException {
byte[] magic = headerIn.readByteArray(8);
api = DexFormat.magicToApi(magic);
View on GitHub (pinned to 1b7ea02c23)
Solutions
- Regenerate/re-dex the input with a toolchain matching what this library supports, or strip newer sections (the D8 `--min-api` flag nudges the format down).
- Update the vendored aosp-dexutils to a revision whose SECTION_TYPE_* set covers the map items present in your dexes.
- Validate with dexdump from the same SDK level as the library expectations to confirm where the unsupported item appears.
Defensive patterns
Strategy: validation
Validate before calling
static final Set<Short> KNOWN_MAP_TYPES = Set.of((short)0x0000,(short)0x0001,(short)0x0002,(short)0x0003,(short)0x0004,(short)0x0005,(short)0x0006,(short)0x1000,(short)0x1001,(short)0x1002,(short)0x1003,(short)0x1004,(short)0x1005,(short)0x2000,(short)0x2001,(short)0x2002,(short)0x2003,(short)0x2004,(short)0x2005,(short)0x2006); // reject before parse: read map types, ensure all in KNOWN_MAP_TYPES
Try / catch
catch (IllegalArgumentException e) with 'unknown section type' -> classify as unsupported-format and route the dex to a newer toolchain instead of retrying
Prevention
- Match library version to the maximum dex format version your min/target SDK toolchain emits.
- Gate CI on parsing a representative dex through this library so format drift fails the build, not release.
When it happens
Trigger: readMap() iterating a map_list whose type field contains a value this vendored copy doesn't know (e.g. newer format sections like call sites / method handles in dex 038+) or garbage from a misaligned read.
Common situations: Feeding an API 26+-style dex (with CALLSITE_ID / METHOD_HANDLE map items) into this older aosp-dexutils snapshot during Tinker patch generation; corrupted map offsets after manual binary edits.
Related errors
- No such map item: ${type}
- Cannot merge dex files that do not contain a map
- Unexpected map value for 0x${type}
- Map is unsorted at ${previous}, ${section}
- Map is unsorted at ${section}
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/b811555966f243cf.
Report an issue: GitHub.