skylot/jadx · error · JadxRuntimeException

Block not found by insn: {}

Error message

Block not found by insn: {}

What it means

Thrown by ConstructorVisitor.insertPhiInsn() when BlockUtils.getBlockByInsn() cannot find the basic block containing a given ConstructorInsn. This method builds a PHI node at the path-cross of two blocks (the current block and the block of another constructor call); if the other constructor's block cannot be located, the SSA/PHI construction cannot proceed and jadx aborts.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/ConstructorVisitor.java:131

	}

	private static @Nullable ArgType searchInstanceType(InvokeNode inv) {
		InsnArg instanceArg = inv.getInstanceArg();
		if (instanceArg == null || !instanceArg.isRegister()) {
			return null;
		}
		InsnNode assignInsn = ((RegisterArg) instanceArg).getSVar().getAssignInsn();
		if (assignInsn == null || assignInsn.getType() != InsnType.NEW_INSTANCE) {
			return null;
		}
		return ((IndexInsnNode) assignInsn).getIndexAsType();
	}

	private static RegisterArg insertPhiInsn(MethodNode mth, BlockNode curBlock,
			RegisterArg instArg, ConstructorInsn otherCtr) {
		BlockNode otherBlock = BlockUtils.getBlockByInsn(mth, otherCtr);
		if (otherBlock == null) {
			throw new JadxRuntimeException("Block not found by insn: " + otherCtr);
		}
		BlockNode crossBlock = BlockUtils.getPathCross(mth, curBlock, otherBlock);
		if (crossBlock == null) {
			// no path cross => PHI insn not needed
			// use new SSA var on usage from current path
			RegisterArg newResArg = instArg.duplicateWithNewSSAVar(mth);
			List<BlockNode> pathBlocks = BlockUtils.collectAllSuccessors(mth, curBlock, true);
			for (RegisterArg useReg : instArg.getSVar().getUseList()) {
				InsnNode parentInsn = useReg.getParentInsn();
				if (parentInsn != null) {
					BlockNode useBlock = BlockUtils.getBlockByInsn(mth, parentInsn, pathBlocks);
					if (useBlock != null) {
						parentInsn.replaceArg(useReg, newResArg.duplicate());
					}
				}
			}
			return newResArg;
		}

View on GitHub (pinned to e738a26571)

Solutions

  1. Upgrade jadx — constructor-visitor and CFG consistency are regularly improved.
  2. Catch JadxRuntimeException per method/class and continue.
  3. Report the issue with the constructor instruction and method context.
  4. Try disabling related optimizations or using conservative decompiler settings.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    javaClass.decompile();
} catch (JadxRuntimeException e) {
    LOG.warn("Constructor PHI construction failed in {}: {}", javaClass.getName(), e.getMessage());
}

Prevention

When it happens

Trigger: insertPhiInsn() is called with a ConstructorInsn otherCtr that was expected to exist in the method's CFG. BlockUtils.getBlockByInsn(mth, otherCtr) returns null — the instruction is not found in any block, perhaps because it was already removed or moved by a prior visitor pass, or because the CFG is inconsistent.

Common situations: Complex constructor patterns with branching (e.g. constructors called conditionally across multiple paths), often in decompiled enum or builder-pattern code. Can also arise from ordering issues between visitor passes where an instruction is referenced after removal.

Related errors


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