skylot/jadx · error · JadxRuntimeException

Null array element type

Error message

Null array element type

What it means

Thrown by ModVisitor.makeFilledArrayInsn() when building a filled-array instruction and the element type cannot be determined. The method tries the instruction's declared element type, then the fill-array-data element type, and finally selectFirst(); if all fail and elType remains null/unknown, jadx cannot construct the array literal and aborts.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java:578

	private static InsnNode makeFilledArrayInsn(MethodNode mth, NewArrayNode newArrayNode, FillArrayInsn insn) {
		ArgType insnArrayType = newArrayNode.getArrayType();
		ArgType insnElementType = insnArrayType.getArrayElement();
		ArgType elType = insn.getElementType();
		if (!elType.isTypeKnown()
				&& insnElementType.isPrimitive()
				&& elType.contains(insnElementType.getPrimitiveType())) {
			elType = insnElementType;
		}
		if (!elType.equals(insnElementType) && !insnArrayType.equals(ArgType.OBJECT)) {
			mth.addWarn("Incorrect type for fill-array insn " + InsnUtils.formatOffset(insn.getOffset())
					+ ", element type: " + elType + ", insn element type: " + insnElementType);
		}
		if (!elType.isTypeKnown()) {
			LOG.warn("Unknown array element type: {} in mth: {}", elType, mth);
			elType = insnElementType.isTypeKnown() ? insnElementType : elType.selectFirst();
			if (elType == null) {
				throw new JadxRuntimeException("Null array element type");
			}
		}

		List<LiteralArg> list = insn.getLiteralArgs(elType);
		InsnNode filledArr = new FilledNewArrayNode(elType, list.size());
		filledArr.setResult(newArrayNode.getResult().duplicate());
		for (LiteralArg arg : list) {
			IFieldInfoRef f = mth.getParentClass().getConstFieldByLiteralArg(arg);
			if (f != null) {
				InsnNode fGet = new IndexInsnNode(InsnType.SGET, f.getFieldInfo(), 0);
				filledArr.addArg(InsnArg.wrapArg(fGet));
				addFieldUsage(f, mth);
			} else {
				filledArr.addArg(arg.duplicate());
			}
		}
		return filledArr;
	}

View on GitHub (pinned to e738a26571)

Solutions

  1. Upgrade jadx — array-type resolution heuristics improve over time.
  2. Catch JadxRuntimeException per class/method and skip.
  3. Report the issue with the method and instruction offset from the error context.
  4. Try decompiling with fallback mode or alternative settings.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    javaClass.decompile();
} catch (JadxRuntimeException e) {
    LOG.warn("Array element type unresolved in {}: {}", javaClass.getName(), e.getMessage());
}

Prevention

When it happens

Trigger: makeFilledArrayInsn() is called with a NewArrayNode and FillArrayInsn. elType is not type-known, insnElementType is also not type-known (or elType.selectFirst() returns null). This means neither the array declaration nor the fill-array-data payload declares a concrete element type.

Common situations: Obfuscated or hand-crafted DEX where the new-array instruction and the fill-array-data payload have inconsistent or missing type information. Also possible with unusual array initialisation patterns from non-standard bytecode generators.

Related errors


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