skylot/jadx · error · JadxRuntimeException

No immediate dominator for block: {}

Error message

No immediate dominator for block: {}

What it means

Thrown during dominator tree construction using the Cooper-Harvey-Kennedy algorithm. For each non-entry block, the algorithm looks for at least one predecessor with an already-computed dominator. If no predecessor has one, the block has no starting point for dominator intersection and the algorithm cannot proceed.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/blocks/DominatorTree.java:61

		doms[0] = sorted.get(0);
		boolean changed = true;
		while (changed) {
			changed = false;
			for (int blockId = 1; blockId < blocksCount; blockId++) {
				BlockNode b = sorted.get(blockId);
				List<BlockNode> preds = predFunc.apply(b);
				int pickedPred = -1;
				BlockNode newIDom = null;
				for (BlockNode pred : preds) {
					int id = pred.getId();
					if (doms[id] != null) {
						newIDom = pred;
						pickedPred = id;
						break;
					}
				}
				if (newIDom == null) {
					throw new JadxRuntimeException("No immediate dominator for block: " + b);
				}
				for (BlockNode predBlock : preds) {
					int predId = predBlock.getId();
					if (predId == pickedPred) {
						continue;
					}
					if (doms[predId] != null) {
						newIDom = intersect(sorted, doms, predBlock, newIDom);
					}
				}
				if (doms[blockId] != newIDom) {
					doms[blockId] = newIDom;
					changed = true;
				}
			}
		}
		return doms;
	}

View on GitHub (pinned to e738a26571)

Solutions

  1. Update jadx — dominator construction is periodically hardened
  2. Report the APK as a jadx issue — include the block structure from the stack trace
  3. This is an internal algorithmic issue, not fixable from user input
  4. Try decompiling specific classes to avoid the problematic method
Defensive patterns

Strategy: try-catch

Try / catch

try {
    jadxDecompiler.load();
    jadxDecompiler.save();
} catch (JadxRuntimeException e) {
    if (e.getMessage().contains("No immediate dominator")) {
        LOG.warn("Dominator computation ordering issue, skipping problematic method");
        for (ClassNode cls : jadxDecompiler.getClasses()) {
            try {
                jadxDecompiler.decompileClass(cls);
            } catch (JadxRuntimeException ex) {
                LOG.warn("Skipped: {}", cls.getFullName());
            }
        }
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: For a non-entry block, all predecessors have null dominator entries (doms[id] == null for every pred). This violates the algorithm's assumption that blocks are processed in reverse-postorder with at least one already-dominated predecessor.

Common situations: Blocks in the sorted list whose predecessors all appear later (ordering violation); disconnected CFG components where a block's predecessors are in a different SCC; bugs in the DFS-based block sorting that produce incorrect reverse-postorder.

Related errors


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