{"record":{"id":"7b99c86e7ef51484","repo":"Tencent/tinker","slug":"unexpected-type-type","errorCode":null,"errorMessage":"Unexpected type: ${type}","messagePattern":"Unexpected type: (.+?)","errorType":"exception","errorClass":"DexException","httpStatus":null,"severity":"error","filePath":"third-party/aosp-dexutils/src/main/java/com/tencent/tinker/android/dex/EncodedValueReader.java","lineNumber":297,"sourceCode":"        case ENCODED_ARRAY:\n            for (int i = 0, size = readArray(); i < size; i++) {\n                skipValue();\n            }\n            break;\n        case ENCODED_ANNOTATION:\n            for (int i = 0, size = readAnnotation(); i < size; i++) {\n                readAnnotationName();\n                skipValue();\n            }\n            break;\n        case ENCODED_NULL:\n            readNull();\n            break;\n        case ENCODED_BOOLEAN:\n            readBoolean();\n            break;\n        default:\n            throw new DexException(\"Unexpected type: \" + Integer.toHexString(type));\n        }\n    }\n\n    private void checkType(int expected) {\n        if (peek() != expected) {\n            throw new IllegalStateException(\n                    String.format(\"Expected %x but was %x\", expected, peek()));\n        }\n    }\n}\n","sourceCodeStart":279,"sourceCodeEnd":308,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/third-party/aosp-dexutils/src/main/java/com/tencent/tinker/android/dex/EncodedValueReader.java#L279-L308","documentation":"Thrown by EncodedValueReader.skipValue() when the one-byte type tag of an encoded value is none of the known ENCODED_* constants (0x00–0x1e range: byte/short/char/int/long/float/double/string/type/field/method/enum/array/annotation/null/boolean). A type tag outside the dispatch table means the stream is misaligned or the dex is corrupt.","triggerScenarios":"Calling skipValue()/readValue dispatch while iterating encoded_array or annotation data whose buffer position has drifted (an earlier value mis-read), or reading a hand-crafted/obfuscated dex with an invalid encoded_value type byte.","commonSituations":"Custom dex tooling built on Dex/EncodedValueReader hitting dexes produced by exotic obfuscators; version skew where a newer dex format introduces a tag this vendored copy does not know; buffer reuse where the reader was left mid-value.","solutions":["Dump the offending dex with a reference tool (dexdump/baksmali) — if it also chokes, the dex itself is malformed; regenerate it.","Verify the reader's buffer position before the failing call — an earlier read of a different-width value typically causes the drift.","Update this third-party aosp-dexutils copy from a newer AOSP revision if the dex comes from a newer format version."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { reader.skipValue(); } catch (DexException e) { /* wrap with dex id + buffer position for triage */ throw new PatchParseException(\"bad encoded value in \" + dexName + \" @0x\" + Integer.toHexString(reader.data.position()), e); }","preventionTips":["Pin the vendored aosp-dexutils version to one matching the dex format version your build emits.","Never reuse one EncodedValueReader across values of different shapes without re-aligning its buffer."],"tags":["dex","encoded-value","parsing","corruption","tinker"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}