skylot/jadx · error · CodegenException
Unknown instruction:
Error message
Unknown instruction:
What it means
Thrown by InsnGen.makeInsnBody() as the default branch of the large switch on insn.getType(). The switch covers dozens of InsnType values (CONST_STR, INVOKE, MOVE, etc.) plus the legacy JAVA_JSR and JAVA_RET fallback cases. Reaching the default means an instruction type is not handled — either a new InsnType was added without a case, or internal state produced an unexpected type.
Source
Thrown at jadx-core/src/main/java/jadx/core/codegen/InsnGen.java:649
code.add(" = ");
addArg(code, insn.getArg(i + 1));
code.add("; ");
}
break;
case JAVA_JSR:
fallbackOnlyInsn(insn);
code.add("jsr -> ").add(MethodGen.getLabelName(((JsrNode) insn).getTarget()));
break;
case JAVA_RET:
fallbackOnlyInsn(insn);
code.add("ret ");
addArg(code, insn.getArg(0));
break;
default:
throw new CodegenException(mth, "Unknown instruction: " + insn.getType());
}
}
/**
* In most cases must be combined with new array instructions.
* Use one by one array fill (can be replaced with System.arrayCopy)
*/
private void fillArray(ICodeWriter code, FillArrayInsn arrayNode) throws CodegenException {
if (mth.checkCommentsLevel(CommentsLevel.INFO)) {
code.add("// fill-array-data instruction");
}
code.startLine();
InsnArg arrArg = arrayNode.getArg(0);
ArgType arrayType = arrArg.getType();
ArgType elemType;
if (arrayType.isTypeKnown() && arrayType.isArray()) {
elemType = arrayType.getArrayElement();
} else {View on GitHub (pinned to e738a26571)
Solutions
- If you added a new InsnType, add a matching case in makeInsnBody().
- Update jadx to the latest version where more instruction types may be handled.
- Report the class and instruction type to the jadx issue tracker.
Defensive patterns
Strategy: try-catch
Try / catch
try {
insnGen.makeInsn(insn, code);
} catch (CodegenException e) {
if (e.getMessage().startsWith("Unknown instruction")) {
code.startLine("// jadx: unknown instruction type: " + insn.getType());
logger.warn("Unknown instruction type in codegen", e);
// Continue with next instruction
} else {
throw e;
}
} Prevention
- If you add a new InsnType, update InsnGen.makeInsnBody() with a case.
- Update jadx to the latest version where more instruction types are supported.
- Report unhandled instruction types to the jadx issue tracker.
When it happens
Trigger: An InsnNode with an InsnType value not covered by the switch. Adding a new instruction type to InsnType without adding a case in makeInsnBody(). Corrupted instruction nodes with wrong type tags.
Common situations: Contributing new instruction support to jadx without updating makeInsnBody(). Rare in normal use — typically a development-time guard. Some uncommon bytecode patterns may produce instructions that reach this point in older jadx versions.
Related errors
- Unknown arg type
- Unknown output format
- Unknown condition mode:
- Unknown loop type:
- Unexpected field type class:
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/6832d3737c0d8309.
Report an issue: GitHub.