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
- Inspect data.getClass() and type (both in message) to see the mismatch.
- Ensure the array stored in FillArrayData matches the width chosen by getElementType (1->byte[], 2->short[], 4->int[], 8->long[]).
- If building FillArrayData programmatically, construct the data array with the correct component type.
- 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 constructing FillArrayData, build the data array with the component type matching getElementType.
- Guard data type before expanding.
- Degrade to an empty list for malformed payloads instead of aborting the method.
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
- Unexpected registers count in {}
- Unknown array element width: {}
- Unexpected visibility flag:
- Unknown visibility flags: {}
- Incorrect negative register number in instruction: {}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/67185c1c26a85c3a.
Report an issue: GitHub.