skylot/jadx · error · JadxRuntimeException

Can't find block by offset: {} in list {}

Error message

Can't find block by offset: {} in list {}

What it means

Thrown by BlockUtils.getBlockByOffset when no block in the supplied casesBlocks iterable has a start offset equal to the requested offset. It is a linear-scan lookup helper used by IfNode/SwitchInsn to resolve branch targets against the method's successors list during block-graph construction. Failure means a branch/case target offset is not present in the expected block list.

Source

Thrown at jadx-core/src/main/java/jadx/core/utils/BlockUtils.java:57

import jadx.core.dex.regions.conditions.IfCondition;
import jadx.core.dex.trycatch.CatchAttr;
import jadx.core.dex.trycatch.ExceptionHandler;
import jadx.core.utils.blocks.BlockSet;
import jadx.core.utils.blocks.DFSIteration;
import jadx.core.utils.exceptions.JadxRuntimeException;

public class BlockUtils {

	private BlockUtils() {
	}

	public static BlockNode getBlockByOffset(int offset, Iterable<BlockNode> casesBlocks) {
		for (BlockNode block : casesBlocks) {
			if (block.getStartOffset() == offset) {
				return block;
			}
		}
		throw new JadxRuntimeException("Can't find block by offset: "
				+ InsnUtils.formatOffset(offset)
				+ " in list " + casesBlocks);
	}

	public static BlockNode selectOther(BlockNode node, List<BlockNode> blocks) {
		List<BlockNode> list = blocks;
		if (list.size() > 2) {
			list = cleanBlockList(list);
		}
		if (list.size() != 2) {
			throw new JadxRuntimeException("Incorrect nodes count for selectOther: " + node + " in " + list);
		}
		BlockNode first = list.get(0);
		if (first != node) {
			return first;
		} else {
			return list.get(1);
		}

View on GitHub (pinned to e738a26571)

Solutions

  1. Update jadx; offset/successor collection is fixed regularly.
  2. Report the input plus the offset and block list from the message.
  3. Skip the affected class and continue the batch.
  4. Catch JadxRuntimeException per class/method when using jadx as a library.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    BlockNode b = BlockUtils.getBlockByOffset(off, blocks);
} catch (JadxRuntimeException e) {
    LOG.warn("offset {} not in block list, skipping", off, e);
}

Prevention

When it happens

Trigger: Building the block graph for an if-instruction (IfNode) or a switch (SwitchInsn) where the branch target offset does not match the startOffset() of any block in the instruction's successors list - e.g. a target that points into the middle of another block, or successors that were not collected correctly.

Common situations: Malformed DEX with branch targets into the middle of instructions, multi-dex inputs with mis-aligned code offsets, or a jadx bug in successor collection. Rare on valid bytecode; common on hand-edited or packed inputs.

Related errors


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