skylot/jadx · error · JadxRuntimeException
Failed to load method reference for insn: {}
Error message
Failed to load method reference for insn: {} What it means
In invokePolymorphic(), InsnDataUtils.getMethodRef(insn) returned null. That helper returns null when insn.getIndexType() is not METHOD_REF or no payload/index is resolvable. An invoke-polymorphic instruction (MethodHandle.invoke/invokeExact) must reference a method, so a null ref is fatal.
Source
Thrown at jadx-core/src/main/java/jadx/core/dex/instructions/InsnDecoder.java:601
inode.addArg(InsnArg.reg(insn, 2, argType));
return inode;
}
private InsnNode cast(InsnData insn, ArgType from, ArgType to) {
InsnNode inode = new IndexInsnNode(InsnType.CAST, to, 1);
inode.setResult(InsnArg.reg(insn, 0, to));
inode.addArg(InsnArg.reg(insn, 1, from));
return inode;
}
private InsnNode invokeCustom(InsnData insn, boolean isRange) {
return InvokeCustomBuilder.build(method, insn, isRange);
}
private InsnNode invokePolymorphic(InsnData insn, boolean isRange) {
IMethodRef mthRef = InsnDataUtils.getMethodRef(insn);
if (mthRef == null) {
throw new JadxRuntimeException("Failed to load method reference for insn: " + insn);
}
MethodInfo callMth = MethodInfo.fromRef(root, mthRef);
IMethodProto proto = insn.getIndexAsProto(insn.getTarget());
// expand call args
List<ArgType> args = Utils.collectionMap(proto.getArgTypes(), ArgType::parse);
ArgType returnType = ArgType.parse(proto.getReturnType());
MethodInfo effectiveCallMth = MethodInfo.fromDetails(root, callMth.getDeclClass(),
callMth.getName(), args, returnType);
return new InvokePolymorphicNode(effectiveCallMth, insn, proto, callMth, isRange);
}
private InsnNode invokeSpecial(InsnData insn) {
IMethodRef mthRef = InsnDataUtils.getMethodRef(insn);
if (mthRef == null) {
throw new JadxRuntimeException("Failed to load method reference for insn: " + insn);
}
MethodInfo mthInfo = MethodInfo.fromRef(root, mthRef);View on GitHub (pinned to e738a26571)
Solutions
- Upgrade JADX (method-ref resolution for polymorphic invokes has seen fixes across releases).
- Validate the DEX with baksmali to confirm the invoke-polymorphic index resolves to a real method.
- Skip the class and continue decompiling the rest of the APK.
- Report the offending instruction offset and class to the JADX tracker.
Defensive patterns
Strategy: try-catch
Try / catch
try {
jadx.load();
} catch (JadxRuntimeException e) {
if (e.getMessage().contains("Failed to load method reference")) {
log.warn("Invoke-polymorphic with unresolved method ref; likely corrupt DEX", e);
} else throw e;
} Prevention
- Validate DEX method_ids and proto_ids with dexdump before decompiling.
- Wrap per-class decompilation in try/catch.
- Keep JADX updated.
When it happens
Trigger: An invoke-polymorphic instruction whose index type is not METHOD_REF, or whose ICustomPayload / index cannot be cast to IMethodRef — indicating a structurally invalid DEX instruction.
Common situations: Corrupt DEX, a packer that rewrites invoke-polymorphic sites incorrectly, or a malformed constant pool / method handle table.
Related errors
- Failed to decode insn: {}
- Unknown instruction: '{}'
- Failed to get call site for insn: {}
- 'invoke-custom' instruction processing error: {}
- Failed to parse type string: {}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/70a72181bbd94505.
Report an issue: GitHub.