skylot/jadx · error · DecodeException

Wrong jadx class set version, got:

Error message

Wrong jadx class set version, got: 

What it means

Thrown by ClsSet.load when the version byte in a .jcst file does not match the expected VERSION constant (currently 5). The header check passes ('jadx-cst') but the subsequent version byte indicates the file was written by a different jadx version with an incompatible serialization format. Jadx increments VERSION when the binary layout changes, making old files unreadable by newer code and vice versa.

Source

Thrown at jadx-core/src/main/java/jadx/core/clsp/ClsSet.java:317

		} else if (argType.isArray()) {
			out.writeByte(TypeEnum.ARRAY.ordinal());
			writeArgType(out, argType.getArrayElement(), names);
		} else {
			throw new JadxRuntimeException("Cannot save type: " + argType);
		}
	}

	private void load(InputStream input) throws IOException, DecodeException {
		try (DataInputStream in = new DataInputStream(new BufferedInputStream(input))) {
			byte[] header = new byte[JADX_CLS_SET_HEADER.length()];
			int readHeaderLength = in.read(header);
			if (readHeaderLength != JADX_CLS_SET_HEADER.length()
					|| !JADX_CLS_SET_HEADER.equals(new String(header, STRING_CHARSET))) {
				throw new DecodeException("Wrong jadx class set header");
			}
			int version = in.readByte();
			if (version != VERSION) {
				throw new DecodeException("Wrong jadx class set version, got: " + version + ", expect: " + VERSION);
			}
			androidApiLevel = in.readInt();
			int clsCount = in.readInt();
			classes = new ClspClass[clsCount];
			for (int i = 0; i < clsCount; i++) {
				int accFlags = in.readInt();
				ClspClassSource clsSource = readClsSource(in);
				String name = readString(in);
				classes[i] = new ClspClass(ArgType.object(name), i, accFlags, clsSource);
			}
			for (int i = 0; i < clsCount; i++) {
				ClspClass nClass = classes[i];
				ClassInfo clsInfo = ClassInfo.fromType(root, nClass.getClsType());
				nClass.setParents(readArgTypesArray(in));
				nClass.setTypeParameters(readArgTypesList(in));
				nClass.setMethods(readClsMethods(in, clsInfo));
			}
		}

View on GitHub (pinned to e738a26571)

Solutions

  1. Ensure the jadx-core JAR and its bundled core.jcst resource are from the same release — rebuild from the same source tree.
  2. Check dependency resolution for conflicting jadx-core versions (use gradle dependencies or mvn dependency:tree) and force a single version.
  3. If loading a user .jcst, regenerate it using ClsSet.save from the same jadx version that will later load it.
  4. Report the expected vs. got version numbers from the error message to confirm the mismatch.
Defensive patterns

Strategy: validation

Validate before calling

// Check the version byte after the header before full load
try (InputStream check = Files.newInputStream(path)) {
    byte[] headerAndVersion = new byte[9];
    int read = check.read(headerAndVersion);
    if (read == 9) {
        int version = headerAndVersion[8] & 0xFF;
        if (version != 5) { // ClsSet.VERSION
            throw new IllegalArgumentException(
                "Version mismatch: file has " + version + ", expected 5");
        }
    }
}

Try / catch

try {
    clsSet.loadFromClstFile();
} catch (DecodeException e) {
    if (e.getMessage().startsWith("Wrong jadx class set version")) {
        throw new IllegalStateException(
            "The .jcst file version is incompatible with this jadx version. "
            + "Ensure jadx-core JAR and core.jcst are from the same release.", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Loading a .jcst file written by an older jadx version (version < 5) or a newer one (version > 5). The bundled core.jcst must match the ClsSet.VERSION of the running jadx-core. A mismatch occurs when mixing jadx-core JARs from different releases, or when a user-supplied .jcst was generated by a different version.

Common situations: Upgrading jadx to a new version that changed the serialization format without regenerating core.jcst. Using a core.jcst from a different jadx release. Mixing jadx library versions in a dependency tree (e.g., jadx-core 1.3 transitively pulled alongside a 1.5 core). Partial build where core.jcst is from a different commit than ClsSet.java.

Related errors


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