skylot/jadx · error · JadxRuntimeException

Failed to find top block for try-catch from: {}

Error message

Failed to find top block for try-catch from: {}

What it means

Thrown when searching for the top block of a try-catch region. The algorithm computes the common dominator of all blocks in the try scope. If the common dominator is null and successor-based adjustments don't yield a valid top block, the control flow graph structure is inconsistent and the try-catch region cannot be anchored.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockExceptionHandler.java:451

	}

	private static BlockNode searchTopBlock(MethodNode mth, List<BlockNode> blocks) {
		BlockNode top = BlockUtils.getTopBlock(blocks);
		if (top != null) {
			return adjustTopBlock(top);
		}
		BlockNode topDom = BlockUtils.getCommonDominator(mth, blocks);
		if (topDom != null) {
			// dominator always return one up block if blocks already contains dominator, use successor instead
			if (topDom.getSuccessors().size() == 1) {
				BlockNode upBlock = topDom.getSuccessors().get(0);
				if (blocks.contains(upBlock)) {
					return upBlock;
				}
			}
			return adjustTopBlock(topDom);
		}
		throw new JadxRuntimeException("Failed to find top block for try-catch from: " + blocks);
	}

	private static BlockNode adjustTopBlock(BlockNode topBlock) {
		if (topBlock.getSuccessors().size() == 1 && !topBlock.contains(AType.EXC_CATCH)) {
			// top block can be lifted by other exception handlers included in blocks list, trying to undo that
			return topBlock.getSuccessors().get(0);
		}
		return topBlock;
	}

	@Nullable
	private static BlockNode searchBottomBlock(MethodNode mth, List<BlockNode> blocks) {
		// search common post-dominator block inside input set
		BlockNode bottom = BlockUtils.getBottomBlock(blocks);
		if (bottom != null) {
			return bottom;
		}
		// not found -> blocks don't have same dominator

View on GitHub (pinned to e738a26571)

Solutions

  1. Update jadx — dominator and try-catch analysis are frequently improved
  2. Report the APK and failing method as a jadx issue
  3. Try decompiling with --fallback mode for the problematic class to get raw output
  4. Exclude the problematic class from decompilation if only specific classes are needed
Defensive patterns

Strategy: try-catch

Try / catch

try {
    jadxDecompiler.load();
    jadxDecompiler.save();
} catch (JadxRuntimeException e) {
    if (e.getMessage().contains("Failed to find top block for try-catch")) {
        LOG.warn("Try-catch dominator issue, retrying individual classes");
        for (ClassNode cls : jadxDecompiler.getClasses()) {
            try {
                jadxDecompiler.decompileClass(cls);
            } catch (JadxRuntimeException ex) {
                LOG.warn("Skipped problematic class: {}", cls.getFullName());
            }
        }
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: BlockUtils.getCommonDominator returns null for the blocks in a try-catch scope, and the successor adjustment path (adjustTopBlock) is never reached because topDom itself is null. This means no single block dominates all blocks in the try region.

Common situations: Unusual CFG shapes produced by obfuscators that merge or split exception regions; try-catch blocks where the handler blocks are unreachable or have no predecessors; CFG inconsistencies from earlier block-processing passes.

Related errors


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