{"record":{"id":"318d8780d69a6d74","repo":"skylot/jadx","slug":"unknown-array-element-width","errorCode":null,"errorMessage":"Unknown array element width: {}","messagePattern":"Unknown array element width: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/dex/instructions/FillArrayData.java","lineNumber":51,"sourceCode":"\t\tthis.data = data;\n\t\tthis.size = size;\n\t\tthis.elemSize = elemSize;\n\t\tthis.elemType = getElementType(elemSize);\n\t}\n\n\tprivate static ArgType getElementType(int elementWidthUnit) {\n\t\tswitch (elementWidthUnit) {\n\t\t\tcase 1:\n\t\t\tcase 0:\n\t\t\t\treturn ONE_BYTE_TYPE;\n\t\t\tcase 2:\n\t\t\t\treturn TWO_BYTES_TYPE;\n\t\t\tcase 4:\n\t\t\t\treturn FOUR_BYTES_TYPE;\n\t\t\tcase 8:\n\t\t\t\treturn EIGHT_BYTES_TYPE;\n\t\t\tdefault:\n\t\t\t\tthrow new JadxRuntimeException(\"Unknown array element width: \" + elementWidthUnit);\n\t\t}\n\t}\n\n\tpublic Object getData() {\n\t\treturn data;\n\t}\n\n\tpublic int getSize() {\n\t\treturn size;\n\t}\n\n\tpublic ArgType getElementType() {\n\t\treturn elemType;\n\t}\n\n\tpublic List<LiteralArg> getLiteralArgs(ArgType type) {\n\t\tList<LiteralArg> list = new ArrayList<>(size);\n\t\tObject array = data;","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/instructions/FillArrayData.java#L33-L69","documentation":"Thrown by FillArrayData.getElementType(int) when the fill-array-data payload specifies an element width (in units) that is not 0, 1, 2, 4, or 8. Those widths map to byte/short/int/long (and float/double via 4/8); any other width is not a valid DEX array payload and cannot be typed.","triggerScenarios":"Decoding a fill-array-data-payload instruction whose element_width_unit field is 3, 5, 6, 7, or >8. This field is part of the DEX format and such values indicate a corrupt or crafted payload.","commonSituations":"Corrupt DEX; hand-crafted array-data sections; truncation causing the reader to pick up the wrong bytes as the width; obfuscators that store data in array-payload form with non-standard widths.","solutions":["Validate the DEX structure with a standard verifier.","Log elementWidthUnit (in message) to confirm the bad value; if it is consistently 3/5/6/7 the payload is likely data-stuffed, not real code.","Update jadx.","Catch at the method-decode boundary and skip/flag the method; treat the payload as opaque data if the intent is anti-decompilation."],"exampleFix":"// before\nswitch (elementWidthUnit) {\n    case 1: case 0: return ONE_BYTE_TYPE;\n    case 2: return TWO_BYTES_TYPE;\n    case 4: return FOUR_BYTES_TYPE;\n    case 8: return EIGHT_BYTES_TYPE;\n    default: throw new JadxRuntimeException(\"Unknown array element width: \" + elementWidthUnit);\n}\n\n// after (fallback to byte width for unknown)\nLOG.warn(\"Unknown array element width {}, defaulting to byte\", elementWidthUnit);\nreturn ONE_BYTE_TYPE;","handlingStrategy":"validation","validationCode":"if (elementWidthUnit != 0 && elementWidthUnit != 1 && elementWidthUnit != 2\n        && elementWidthUnit != 4 && elementWidthUnit != 8) {\n    LOG.warn(\"Non-standard array element width {}, defaulting to byte\", elementWidthUnit);\n}","typeGuard":"static boolean isValidElementWidth(int w) {\n    return w == 0 || w == 1 || w == 2 || w == 4 || w == 8;\n}","tryCatchPattern":"ArgType elemType;\ntry {\n    elemType = FillArrayData.getElementType(width);\n} catch (JadxRuntimeException e) {\n    elemType = ArgType.BYTE; // safe fallback\n    LOG.warn(\"Falling back to byte element type for width {}\", width);\n}","preventionTips":["Validate the DEX array-payload structure with a verifier.","Treat non-standard widths as data-stuffing/anti-decompilation, not real code.","Fall back to a byte width rather than aborting on unknown payloads."],"tags":["bytecode","dex","instruction-decode","array-data"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}