skylot/jadx · error · JadxRuntimeException

Unknown condition mode:

Error message

Unknown condition mode: 

What it means

Thrown by ConditionGen.add() as the default branch of the switch on condition.getMode(). IfCondition.Mode defines COMPARE, TERNARY, NOT, AND, OR — all are handled. The default is an exhaustive-switch guard that should be unreachable; hitting it indicates a new Mode constant was added without updating this switch or an internal invariant violation.

Source

Thrown at jadx-core/src/main/java/jadx/core/codegen/ConditionGen.java:74

			case COMPARE:
				addCompare(code, stack, condition.getCompare());
				break;

			case TERNARY:
				addTernary(code, stack, condition);
				break;

			case NOT:
				addNot(code, stack, condition);
				break;

			case AND:
			case OR:
				addAndOr(code, stack, condition);
				break;

			default:
				throw new JadxRuntimeException("Unknown condition mode: " + condition.getMode());
		}
		stack.pop();
	}

	private void wrap(ICodeWriter code, CondStack stack, IfCondition cond) throws CodegenException {
		boolean wrap = isWrapNeeded(cond);
		if (wrap) {
			code.add('(');
		}
		add(code, stack, cond);
		if (wrap) {
			code.add(')');
		}
	}

	private void wrap(ICodeWriter code, InsnArg firstArg) throws CodegenException {
		boolean wrap = isArgWrapNeeded(firstArg);
		if (wrap) {

View on GitHub (pinned to e738a26571)

Solutions

  1. If you added a new IfCondition.Mode, add a matching case in ConditionGen.add().
  2. Report as an internal jadx bug with the class that triggered it.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    conditionGen.add(code, condition);
} catch (JadxRuntimeException e) {
    if (e.getMessage().startsWith("Unknown condition mode")) {
        // Fallback: emit the condition as a comment
        code.add("/* unknown condition: " + condition.getMode() + " */");
        logger.warn("Unhandled condition mode", e);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: A new IfCondition.Mode enum value exists but this switch was not updated. Internal corruption of the condition tree producing an unexpected mode value.

Common situations: Contributing a new condition mode to jadx without updating all switch sites. Extremely unlikely to occur from user input — this is a developer-facing guard.

Related errors


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