{"record":{"id":"67185c1c26a85c3a","repo":"skylot/jadx","slug":"unknown-type-expected","errorCode":null,"errorMessage":"Unknown type: {}, expected: {}","messagePattern":"Unknown type: (.+?), expected: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/dex/instructions/FillArrayData.java","lineNumber":92,"sourceCode":"\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tfor (short b : (short[]) array) {\n\t\t\t\t\tlist.add(InsnArg.lit(b, type));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tfor (int b : (int[]) array) {\n\t\t\t\t\tlist.add(InsnArg.lit(b, type));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\tfor (long b : (long[]) array) {\n\t\t\t\t\tlist.add(InsnArg.lit(b, type));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new JadxRuntimeException(\"Unknown type: \" + data.getClass() + \", expected: \" + type);\n\t\t}\n\t\treturn list;\n\t}\n\n\t@Override\n\tpublic boolean isSame(InsnNode obj) {\n\t\tif (this == obj) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!(obj instanceof FillArrayData) || !super.isSame(obj)) {\n\t\t\treturn false;\n\t\t}\n\t\tFillArrayData other = (FillArrayData) obj;\n\t\treturn elemType.equals(other.elemType) && data == other.data;\n\t}\n\n\t@Override\n\tpublic InsnNode copy() {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/instructions/FillArrayData.java#L74-L110","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ndefault:\n    throw new JadxRuntimeException(\"Unknown type: \" + data.getClass() + \", expected: \" + type);\n\n// after (graceful degradation)\nLOG.warn(\"Unknown fill-array data type {} (expected {}); emitting empty\", data.getClass(), type);\nreturn list;","handlingStrategy":"type-guard","validationCode":"Class<?> dataCls = data.getClass();\nboolean ok = dataCls == byte[].class || dataCls == short[].class\n        || dataCls == int[].class || dataCls == long[].class;\nif (!ok) {\n    LOG.warn(\"Fill-array data is {} (expected primitive array)\", dataCls);\n}","typeGuard":"static boolean isSupportedFillArrayData(Object data) {\n    Class<?> c = data.getClass();\n    return c == byte[].class || c == short[].class || c == int[].class || c == long[].class;\n}","tryCatchPattern":"List<LiteralArg> list;\ntry {\n    list = expandArrayData(data, type);\n} catch (JadxRuntimeException e) {\n    LOG.warn(\"Could not expand fill-array data ({}): {}\", data.getClass(), e.getMessage());\n    list = Collections.emptyList();\n}","preventionTips":["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."],"tags":["bytecode","dex","array-data","invariant"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}