{"record":{"id":"d894043b49d2784f","repo":"skylot/jadx","slug":"payload-for-switch-not-found-at","errorCode":null,"errorMessage":"Payload for switch not found at {}","messagePattern":"Payload for switch not found at (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/dex/visitors/ProcessInstructionsVisitor.java","lineNumber":132,"sourceCode":"\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void attachSwitchData(InsnNode[] insnByOffset, int offset, SwitchInsn sw) {\n\t\tint nextInsnOffset = getNextInsnOffset(insnByOffset, offset);\n\t\tint dataTarget = sw.getDataTarget();\n\t\tInsnNode switchDataInsn = getInsnAtOffset(insnByOffset, dataTarget);\n\t\tif (switchDataInsn != null && switchDataInsn.getType() == InsnType.SWITCH_DATA) {\n\t\t\tSwitchData data = (SwitchData) switchDataInsn;\n\t\t\tdata.fixTargets(offset);\n\t\t\tsw.attachSwitchData(data, nextInsnOffset);\n\t\t\tremoveInsn(insnByOffset, switchDataInsn);\n\t\t} else {\n\t\t\tthrow new JadxRuntimeException(\"Payload for switch not found at \" + InsnUtils.formatOffset(dataTarget));\n\t\t}\n\t}\n\n\tprivate static void mergeMoveResult(InsnNode[] insnByOffset, int offset, InsnNode insn, ArgType resType) {\n\t\tint nextInsnOffset = getNextInsnOffset(insnByOffset, offset);\n\t\tif (nextInsnOffset == -1) {\n\t\t\treturn;\n\t\t}\n\t\tInsnNode nextInsn = insnByOffset[nextInsnOffset];\n\t\tif (nextInsn.getType() != InsnType.MOVE_RESULT) {\n\t\t\treturn;\n\t\t}\n\t\tRegisterArg moveRes = nextInsn.getResult();\n\t\tinsn.setResult(moveRes.duplicate(resType));\n\t\tinsn.copyAttributesFrom(nextInsn);\n\t\tremoveInsn(insnByOffset, nextInsn);\n\t}\n","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/visitors/ProcessInstructionsVisitor.java#L114-L150","documentation":"Thrown during instruction post-processing when a switch instruction (packed or sparse) references a switch-data payload at a specific code offset, but no SWITCH_DATA instruction exists at that offset. Switch instructions require a data payload containing the case keys and target offsets; if the payload is absent, the switch cannot be resolved.","triggerScenarios":"A SwitchInsn.getDataTarget() returns an offset where insnByOffset[dataTarget] is null or not InsnType.SWITCH_DATA. The switch table payload was removed, relocated, or corrupted.","commonSituations":"Obfuscators that relocate or encrypt switch tables; DEX files from packers that strip non-essential payload sections; corrupted downloads or incomplete merges of multidex files where switch data landed in a different DEX.","solutions":["Check DEX file integrity with baksmali/dexdump to verify switch payloads are present","Ensure all DEX files from a multidex APK are provided together as input","Update jadx and retry — switch payload resolution is periodically hardened","Report the APK with the method and offset as a jadx issue"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Check for switch payload integrity using baksmali as a pre-check\ntry {\n    Process p = Runtime.getRuntime().exec(new String[]{\"baksmali\", \"d\", apkFile, \"-o\", \"/tmp/baksmali_check\"});\n    int exit = p.waitFor();\n    if (exit != 0) {\n        LOG.warn(\"baksmali reported errors — DEX may have malformed switch payloads\");\n    }\n} catch (Exception ignored) {}","typeGuard":null,"tryCatchPattern":"try {\n    jadxDecompiler.load();\n    jadxDecompiler.save();\n} catch (JadxRuntimeException e) {\n    if (e.getMessage().contains(\"Payload for switch not found\")) {\n        LOG.warn(\"Malformed switch payload, trying fallback decompilation\");\n        args.setFallbackMode(true);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Validate DEX structure with baksmali/dexdump before decompiling","Provide all multidex DEX files together to avoid missing switch payloads","Keep jadx updated for switch payload resolution improvements"],"tags":["bytecode","instruction-processing","switch","obfuscation","decompiler"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}