skylot/jadx · error · JadxRuntimeException

Several immutable types in one variable: {}, vars: {}

Error message

Several immutable types in one variable: {}, vars: {}

What it means

Thrown by InitCodeVariables.setCodeVarType() when a single code variable (a logical variable formed by connected SSA vars through PHI instructions) has more than one distinct, known, immutable type. Immutable types (e.g. primitives, strings) are used to infer variable types; finding two different immutable types in one variable is an inconsistency that indicates a type-inference conflict.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/InitCodeVariables.java:107

			});
		} else {
			ssaVar.setCodeVar(codeVar);
		}
	}

	private static void setCodeVarType(CodeVar codeVar, Set<SSAVar> vars) {
		if (vars.size() > 1) {
			List<ArgType> imTypes = vars.stream()
					.map(SSAVar::getImmutableType)
					.filter(Objects::nonNull)
					.filter(ArgType::isTypeKnown)
					.distinct()
					.collect(Collectors.toList());
			int imCount = imTypes.size();
			if (imCount == 1) {
				codeVar.setType(imTypes.get(0));
			} else if (imCount > 1) {
				throw new JadxRuntimeException("Several immutable types in one variable: " + imTypes + ", vars: " + vars);
			}
		}
	}

	private static void collectConnectedVars(List<PhiInsn> phiInsnList, Set<SSAVar> vars) {
		if (phiInsnList.isEmpty()) {
			return;
		}
		for (PhiInsn phiInsn : phiInsnList) {
			SSAVar resultVar = phiInsn.getResult().getSVar();
			if (vars.add(resultVar)) {
				collectConnectedVars(resultVar.getPhiList(), vars);
			}
			phiInsn.getArguments().forEach(arg -> {
				SSAVar sVar = ((RegisterArg) arg).getSVar();
				if (vars.add(sVar)) {
					collectConnectedVars(sVar.getPhiList(), vars);
				}

View on GitHub (pinned to e738a26571)

Solutions

  1. Upgrade jadx — type-inference and code-variable logic are continuously refined.
  2. Catch JadxRuntimeException per class/method and continue with remaining decompilation.
  3. Report the issue with the type list and SSA vars from the error message.
  4. Try disabling type-inference-related optimizations via jadx args.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    javaClass.decompile();
} catch (JadxRuntimeException e) {
    LOG.warn("Type-inference conflict in {}: {}", javaClass.getName(), e.getMessage());
}

Prevention

When it happens

Trigger: setCodeVarType() collects all SSA vars connected via PHI, maps each to its immutable type, filters to known and distinct types, and finds imCount > 1. This means two connected SSA variables carry different immutable type information — e.g. one is inferred as int, another as float — through a PHI merge.

Common situations: Complex bytecode with unusual type flows, often from bytecode optimisers or obfuscators that merge registers of different types. Can also arise from type-inference edge cases in code with heavy arithmetic or conditional assignments.

Related errors


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