{"record":{"id":"6bc3c7831f2f8332","repo":"Tencent/tinker","slug":"multiple-switch-instructions-refer-to-the-same-pay","errorCode":null,"errorMessage":"Multiple switch instructions refer to the same payload. This is not currently supported. Please file a bug :)","messagePattern":"Multiple switch instructions refer to the same payload\\. This is not currently supported\\. Please file a bug :\\)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"tinker-build/tinker-patch-lib/src/main/java/org/jf/dexlib2/builder/BuilderMutableMethodImplementation.java","lineNumber":496,"sourceCode":"                        if (targetInstruction.getOpcode() == Opcode.NOP) {\n                            targetInstruction = getFirstNonNop(targetLocation.index + 1);\n                        }\n                        if (targetInstruction == null || !(targetInstruction instanceof BuilderSwitchPayload)) {\n                            throw new IllegalStateException(String.format(\"Switch instruction at address/index \"\n                                            + \"0x%x/%d does not refer to a payload instruction.\",\n                                    location.codeAddress, location.index));\n                        }\n                        if ((instruction.opcode == Opcode.PACKED_SWITCH\n                                && targetInstruction.getOpcode() != Opcode.PACKED_SWITCH_PAYLOAD)\n                                || (instruction.opcode == Opcode.SPARSE_SWITCH\n                                        && targetInstruction.getOpcode() != Opcode.SPARSE_SWITCH_PAYLOAD)) {\n                            throw new IllegalStateException(String.format(\"Switch instruction at address/index \"\n                                            + \"0x%x/%d refers to the wrong type of payload instruction.\",\n                                    location.codeAddress, location.index));\n                        }\n\n                        if (!payloadLocations.add(targetLocation)) {\n                            throw new IllegalStateException(\"Multiple switch instructions refer to the same payload. \"\n                                    + \"This is not currently supported. Please file a bug :)\");\n                        }\n\n                        ((BuilderSwitchPayload) targetInstruction).referrer = location;\n                        break;\n                    }\n                    default: {\n                        break;\n                    }\n                }\n            }\n        }\n\n        boolean madeChanges;\n        do {\n            madeChanges = false;\n\n            for (int index = 0; index < instructionList.size(); index++) {","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-build/tinker-patch-lib/src/main/java/org/jf/dexlib2/builder/BuilderMutableMethodImplementation.java#L478-L514","documentation":"dexlib2 builder validation error: two or more switch instructions target the same switch payload location. The builder tracks payloads in a HashSet; a duplicate means the dex shares one payload between multiple switches, which the builder's one-referrer model does not support.","triggerScenarios":"A method contains multiple PACKED_SWITCH/SPARSE_SWITCH instructions whose offsets all resolve to the same payload location; hit when Tinker runs dexlib2's instruction-building pass over such a dex.","commonSituations":"Size-optimized or obfuscated dex where a protector merges switch payloads; occasionally a genuine dexlib2 bug on legal-but-rare dex shapes ('Please file a bug' message).","solutions":["Upgrade Tinker / dexlib2 — shared-payload handling has fixes in newer smali releases","Disable the dex optimization/protector that merges switch payloads and rebuild","Report to the Tinker/smali issue tracker with the offending dex if the dex is verified valid"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    // dexlib2 builder conversion\n} catch (IllegalStateException e) {\n    if (String.valueOf(e.getMessage()).contains(\"same payload\")) {\n        // exclude offending dex from patch, notify tooling team\n    } else { throw e; }\n}","preventionTips":["Upgrade Tinker regularly for shared-payload fixes in bundled smali/dexlib2","Report reproducible cases upstream with the offending dex"],"tags":["dexlib2","dex","switch-payload","obfuscation","patch-build"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}