{"record":{"id":"bd9a3ed216b74576","repo":"Tencent/tinker","slug":"no-such-map-item-type","errorCode":null,"errorMessage":"No such map item: ${type}","messagePattern":"No such map item: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"third-party/aosp-dexutils/src/main/java/com/tencent/tinker/android/dex/TableOfContents.java","lineNumber":274,"sourceCode":"\n        dataOff = header.byteCount\n                + stringIds.byteCount\n                + typeIds.byteCount\n                + protoIds.byteCount\n                + fieldIds.byteCount\n                + methodIds.byteCount\n                + classDefs.byteCount;\n\n        dataSize = fileSize - dataOff;\n    }\n\n    private Section getSection(short type) {\n        for (Section section : sections) {\n            if (section.type == type) {\n                return section;\n            }\n        }\n        throw new IllegalArgumentException(\"No such map item: \" + type);\n    }\n\n    public void writeHeader(Dex.Section out) throws IOException {\n        out.write(DexFormat.apiToMagic(api).getBytes(\"UTF-8\"));\n        out.writeInt(checksum);\n        out.write(signature);\n        out.writeInt(fileSize);\n        out.writeInt(SizeOf.HEADER_ITEM);\n        out.writeInt(DexFormat.ENDIAN_TAG);\n        out.writeInt(linkSize);\n        out.writeInt(linkOff);\n        out.writeInt(mapList.off);\n        out.writeInt(stringIds.size);\n        out.writeInt((stringIds.exists() ? stringIds.off : 0));\n        out.writeInt(typeIds.size);\n        out.writeInt((typeIds.exists() ? typeIds.off : 0));\n        out.writeInt(protoIds.size);\n        out.writeInt((protoIds.exists() ? protoIds.off : 0));","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/third-party/aosp-dexutils/src/main/java/com/tencent/tinker/android/dex/TableOfContents.java#L256-L292","documentation":"Thrown by the loop-based getSection(short type) (used by readMap) when a map_list entry's type code matches none of the Section instances in the table. Functionally the same failure as the switch-based variant at line 150, reached through the map-reading path.","triggerScenarios":"readMap encounters a map item type constant this library's Section array doesn't define — e.g. TYPE_CALLSITE_ID (0x0007) or TYPE_METHOD_HANDLE (0x0008) from dex format 038 in an older vendored copy — or garbage type bytes.","commonSituations":"Tinker patch builds consuming modern dexes (Kotlin, desugared lambdas produce method handles/call sites) with an outdated aosp-dexutils dependency; corrupted map regions.","solutions":["Upgrade the third-party aosp-dexutils/tinker dependency to a version whose Section table includes the newer map item types.","Lower the dex format version at generation time (d8 `--min-api 25`/equivalent avoids emitting call-site/method-handle items) so old parsers cope.","Diagnose with dexdump to see the exact unknown type code and where it comes from."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-scan map_list types before TableOfContents.readFrom\nint mapOff = headerBuf.getInt(52);\n// parse map entries; if any type in {0x0007, 0x0008} (callsite/method_handle) and library is old, route to upgraded toolchain","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) with 'No such map item' -> version-skew: upgrade dependency or lower emitted dex format version","preventionTips":["Keep tinker/aosp-dexutils aligned with the newest dex producer in your toolchain (Kotlin/desugaring introduce new item types).","Pin and test the (producer, consumer) dex-format version pair in CI."],"tags":["dex","map-list","section","version-skew","tinker"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}