skylot/jadx · error · JadxRuntimeException

Unknown array element width: {}

Error message

Unknown array element width: {}

What it means

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.

Source

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

		this.data = data;
		this.size = size;
		this.elemSize = elemSize;
		this.elemType = getElementType(elemSize);
	}

	private static ArgType getElementType(int elementWidthUnit) {
		switch (elementWidthUnit) {
			case 1:
			case 0:
				return ONE_BYTE_TYPE;
			case 2:
				return TWO_BYTES_TYPE;
			case 4:
				return FOUR_BYTES_TYPE;
			case 8:
				return EIGHT_BYTES_TYPE;
			default:
				throw new JadxRuntimeException("Unknown array element width: " + elementWidthUnit);
		}
	}

	public Object getData() {
		return data;
	}

	public int getSize() {
		return size;
	}

	public ArgType getElementType() {
		return elemType;
	}

	public List<LiteralArg> getLiteralArgs(ArgType type) {
		List<LiteralArg> list = new ArrayList<>(size);
		Object array = data;

View on GitHub (pinned to e738a26571)

Solutions

  1. Validate the DEX structure with a standard verifier.
  2. 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.
  3. Update jadx.
  4. Catch at the method-decode boundary and skip/flag the method; treat the payload as opaque data if the intent is anti-decompilation.

Example fix

// before
switch (elementWidthUnit) {
    case 1: case 0: return ONE_BYTE_TYPE;
    case 2: return TWO_BYTES_TYPE;
    case 4: return FOUR_BYTES_TYPE;
    case 8: return EIGHT_BYTES_TYPE;
    default: throw new JadxRuntimeException("Unknown array element width: " + elementWidthUnit);
}

// after (fallback to byte width for unknown)
LOG.warn("Unknown array element width {}, defaulting to byte", elementWidthUnit);
return ONE_BYTE_TYPE;
Defensive patterns

Strategy: validation

Validate before calling

if (elementWidthUnit != 0 && elementWidthUnit != 1 && elementWidthUnit != 2
        && elementWidthUnit != 4 && elementWidthUnit != 8) {
    LOG.warn("Non-standard array element width {}, defaulting to byte", elementWidthUnit);
}

Type guard

static boolean isValidElementWidth(int w) {
    return w == 0 || w == 1 || w == 2 || w == 4 || w == 8;
}

Try / catch

ArgType elemType;
try {
    elemType = FillArrayData.getElementType(width);
} catch (JadxRuntimeException e) {
    elemType = ArgType.BYTE; // safe fallback
    LOG.warn("Falling back to byte element type for width {}", width);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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