skylot/jadx · error · JadxRuntimeException

Same handlers in try block: {}

Error message

Same handlers in try block: {}

What it means

Thrown while sorting exception handlers within a try block. If two ExceptionHandler objects compare as equal via .equals(), the sort comparator throws. Duplicate handlers in a try block indicate either a bytecode production bug or intentional obfuscation that duplicates catch clauses.

Source

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

				return false;
			}
			resultHandler.addCatchTypes(mth, handler.getCatchTypes());
			handler.markForRemove();
			return true;
		});
		return true;
	}

	private static void sortHandlers(MethodNode mth, List<TryCatchBlockAttr> tryBlocks) {
		TypeCompare typeCompare = mth.root().getTypeCompare();
		Comparator<ArgType> comparator = typeCompare.getReversedComparator();
		for (TryCatchBlockAttr tryBlock : tryBlocks) {
			for (ExceptionHandler handler : tryBlock.getHandlers()) {
				handler.getCatchTypes().sort((first, second) -> compareByTypeAndName(comparator, first, second));
			}
			tryBlock.getHandlers().sort((first, second) -> {
				if (first.equals(second)) {
					throw new JadxRuntimeException("Same handlers in try block: " + tryBlock);
				}
				if (first.isCatchAll()) {
					return 1;
				}
				if (second.isCatchAll()) {
					return -1;
				}
				return compareByTypeAndName(comparator,
						ListUtils.first(first.getCatchTypes()), ListUtils.first(second.getCatchTypes()));
			});
		}
	}

	@SuppressWarnings("ComparatorResultComparison")
	private static int compareByTypeAndName(Comparator<ArgType> comparator, ClassInfo first, ClassInfo second) {
		int r = comparator.compare(first.getType(), second.getType());
		if (r == -2) {
			// on conflict sort by name

View on GitHub (pinned to e738a26571)

Solutions

  1. Update jadx — newer versions may deduplicate handlers before sorting
  2. Report the APK as a jadx issue — duplicate handlers are a clear edge case worth handling gracefully
  3. Verify the DEX file with baksmali to confirm duplicate handlers exist in the raw bytecode
  4. Exclude the affected class if only partial decompilation is needed
Defensive patterns

Strategy: try-catch

Try / catch

try {
    jadxDecompiler.load();
    jadxDecompiler.save();
} catch (JadxRuntimeException e) {
    if (e.getMessage().contains("Same handlers in try block")) {
        LOG.warn("Duplicate exception handlers detected, skipping problematic class");
        // Use per-class loop to continue past the problematic class
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: During sortHandlers, the comparator encounters two handlers in tryBlock.getHandlers() that are .equals()-equal. Since the comparator is called by List.sort, this means the handler list contains true duplicates.

Common situations: Obfuscators that duplicate exception handler entries to confuse analysis; DEX files produced by bytecode manipulation libraries (ASM, etc.) with bugs; manual DEX editing or merging tools that duplicate catch entries.

Related errors


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