skylot/jadx · error · JadxRuntimeException

Unknown type: {}, expected: {}

Error message

Unknown type: {}, expected: {}

What it means

Thrown while expanding a fill-array-data payload into literal arguments when the Java array type backing the payload does not match the resolved ArgType. The switch dispatches on the element type (byte[]/short[]/int[]/long[]) and casts the data object; a cast to the wrong array type, or a data object whose class is none of those, hits the default.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/instructions/FillArrayData.java:92

				}
				break;
			case 2:
				for (short b : (short[]) array) {
					list.add(InsnArg.lit(b, type));
				}
				break;
			case 4:
				for (int b : (int[]) array) {
					list.add(InsnArg.lit(b, type));
				}
				break;
			case 8:
				for (long b : (long[]) array) {
					list.add(InsnArg.lit(b, type));
				}
				break;
			default:
				throw new JadxRuntimeException("Unknown type: " + data.getClass() + ", expected: " + type);
		}
		return list;
	}

	@Override
	public boolean isSame(InsnNode obj) {
		if (this == obj) {
			return true;
		}
		if (!(obj instanceof FillArrayData) || !super.isSame(obj)) {
			return false;
		}
		FillArrayData other = (FillArrayData) obj;
		return elemType.equals(other.elemType) && data == other.data;
	}

	@Override
	public InsnNode copy() {

View on GitHub (pinned to e738a26571)

Solutions

  1. Inspect data.getClass() and type (both in message) to see the mismatch.
  2. Ensure the array stored in FillArrayData matches the width chosen by getElementType (1->byte[], 2->short[], 4->int[], 8->long[]).
  3. If building FillArrayData programmatically, construct the data array with the correct component type.
  4. Catch at decode boundary and flag the method as inconsistent for malformed payloads.

Example fix

// before
default:
    throw new JadxRuntimeException("Unknown type: " + data.getClass() + ", expected: " + type);

// after (graceful degradation)
LOG.warn("Unknown fill-array data type {} (expected {}); emitting empty", data.getClass(), type);
return list;
Defensive patterns

Strategy: type-guard

Validate before calling

Class<?> dataCls = data.getClass();
boolean ok = dataCls == byte[].class || dataCls == short[].class
        || dataCls == int[].class || dataCls == long[].class;
if (!ok) {
    LOG.warn("Fill-array data is {} (expected primitive array)", dataCls);
}

Type guard

static boolean isSupportedFillArrayData(Object data) {
    Class<?> c = data.getClass();
    return c == byte[].class || c == short[].class || c == int[].class || c == long[].class;
}

Try / catch

List<LiteralArg> list;
try {
    list = expandArrayData(data, type);
} catch (JadxRuntimeException e) {
    LOG.warn("Could not expand fill-array data ({}): {}", data.getClass(), e.getMessage());
    list = Collections.emptyList();
}

Prevention

When it happens

Trigger: The data object stored in FillArrayData is not one of byte[]/short[]/int[]/long[] (e.g. it is an Object[] or null), or the resolved type selected a branch whose cast then fails. Indicates a mismatch between getElementType() and the actual data array produced when reading the payload.

Common situations: Inconsistent FillArrayData construction (data array width != element type chosen); corrupt payload; a pass that replaced the data array with a different type; edge cases around 0-width arrays.

Related errors


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