skylot/jadx · error · JadxRuntimeException

Wrong literal type: {} for value: {}

Error message

Wrong literal type: {} for value: {}

What it means

LiteralArg's private constructor rejects a non-zero value paired with an object type. A non-zero object literal is semantically impossible in the JVM (object references are not literals), so the constructor throws immediately. This is an internal invariant guard, not normally reachable from external input.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/instructions/args/LiteralArg.java:44

		if (value < 0) {
			return ArgType.NARROW_NEG_NUMBERS;
		}
		return ArgType.NARROW_NUMBERS_NO_BOOL;
	}

	public static LiteralArg litFalse() {
		return new LiteralArg(0, ArgType.BOOLEAN);
	}

	public static LiteralArg litTrue() {
		return new LiteralArg(1, ArgType.BOOLEAN);
	}

	private final long literal;

	private LiteralArg(long value, ArgType type) {
		if (value != 0 && type.isObject()) {
			throw new JadxRuntimeException("Wrong literal type: " + type + " for value: " + value);
		}
		this.literal = value;
		this.type = type;
	}

	public long getLiteral() {
		return literal;
	}

	@Override
	public void setType(ArgType type) {
		super.setType(type);
	}

	@Override
	public boolean isLiteral() {
		return true;
	}

View on GitHub (pinned to e738a26571)

Solutions

  1. Upgrade JADX.
  2. If extending JADX, audit your use of LiteralArg.make to ensure object types are only used with value 0.
  3. Use LiteralArg.makeWithFixedType to let JADX correct the type automatically.
  4. Report the method/insn and full trace to the JADX tracker.

Example fix

// before
new LiteralArg(5, ArgType.OBJECT) // throws

// after
LiteralArg.makeWithFixedType(5, ArgType.INT) // safe: type auto-fixed
Defensive patterns

Strategy: type-guard

Validate before calling

// If you construct LiteralArg values in a plugin/extension, guard the type.
static LiteralArg safeLit(long value, ArgType type) {
    if (value != 0 && type.isObject()) {
        type = ArgType.NARROW_NUMBERS; // demote to numeric
    }
    return LiteralArg.make(value, type);
}

Type guard

// Narrow before constructing: never pair a non-zero value with an object type.
static boolean isSafeLiteral(long value, ArgType type) {
    return value == 0 || !type.isObject();
}

Try / catch

try {
    LiteralArg arg = LiteralArg.make(value, type);
} catch (JadxRuntimeException e) {
    if (e.getMessage().contains("Wrong literal type")) {
        arg = LiteralArg.makeWithFixedType(value, ArgType.INT);
    } else throw e;
}

Prevention

When it happens

Trigger: Internal code constructs LiteralArg.make(nonZero, someObjectType) — a type-inference or instruction-building bug that assigns an object type to a non-zero literal.

Common situations: A regression in JADX's type inference or literal handling, or a plugin/extension that misuses the LiteralArg constructor. Rarely triggered by input alone.

Related errors


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