skylot/jadx · error · JadxRuntimeException

Payload for switch not found at {}

Error message

Payload for switch not found at {}

What it means

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.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/ProcessInstructionsVisitor.java:132

					break;

				default:
					break;
			}
		}
	}

	private static void attachSwitchData(InsnNode[] insnByOffset, int offset, SwitchInsn sw) {
		int nextInsnOffset = getNextInsnOffset(insnByOffset, offset);
		int dataTarget = sw.getDataTarget();
		InsnNode switchDataInsn = getInsnAtOffset(insnByOffset, dataTarget);
		if (switchDataInsn != null && switchDataInsn.getType() == InsnType.SWITCH_DATA) {
			SwitchData data = (SwitchData) switchDataInsn;
			data.fixTargets(offset);
			sw.attachSwitchData(data, nextInsnOffset);
			removeInsn(insnByOffset, switchDataInsn);
		} else {
			throw new JadxRuntimeException("Payload for switch not found at " + InsnUtils.formatOffset(dataTarget));
		}
	}

	private static void mergeMoveResult(InsnNode[] insnByOffset, int offset, InsnNode insn, ArgType resType) {
		int nextInsnOffset = getNextInsnOffset(insnByOffset, offset);
		if (nextInsnOffset == -1) {
			return;
		}
		InsnNode nextInsn = insnByOffset[nextInsnOffset];
		if (nextInsn.getType() != InsnType.MOVE_RESULT) {
			return;
		}
		RegisterArg moveRes = nextInsn.getResult();
		insn.setResult(moveRes.duplicate(resType));
		insn.copyAttributesFrom(nextInsn);
		removeInsn(insnByOffset, nextInsn);
	}

View on GitHub (pinned to e738a26571)

Solutions

  1. Check DEX file integrity with baksmali/dexdump to verify switch payloads are present
  2. Ensure all DEX files from a multidex APK are provided together as input
  3. Update jadx and retry — switch payload resolution is periodically hardened
  4. Report the APK with the method and offset as a jadx issue
Defensive patterns

Strategy: try-catch

Validate before calling

// Check for switch payload integrity using baksmali as a pre-check
try {
    Process p = Runtime.getRuntime().exec(new String[]{"baksmali", "d", apkFile, "-o", "/tmp/baksmali_check"});
    int exit = p.waitFor();
    if (exit != 0) {
        LOG.warn("baksmali reported errors — DEX may have malformed switch payloads");
    }
} catch (Exception ignored) {}

Try / catch

try {
    jadxDecompiler.load();
    jadxDecompiler.save();
} catch (JadxRuntimeException e) {
    if (e.getMessage().contains("Payload for switch not found")) {
        LOG.warn("Malformed switch payload, trying fallback decompilation");
        args.setFallbackMode(true);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/d894043b49d2784f. Report an issue: GitHub.