skylot/jadx · error · DecodeException

Wrong jadx source identifier:

Error message

Wrong jadx source identifier: 

What it means

Thrown by ClsSet.readClsSource when the source identifier byte read from a .jcst stream is outside the valid range of ClspClassSource enum ordinals. The method reads an unsigned byte and checks it against the enum length. The enum currently has 4 values (APP=0, CORE=1, ANDROID_CAR=2, APACHE_HTTP_LEGACY_CLIENT=3), so valid identifiers are 0–3. A value of 4 or higher is rejected as corrupt or from an incompatible file.

Source

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

				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));
			}
		}
	}

	private static ClspClassSource readClsSource(DataInputStream in) throws IOException, DecodeException {
		int source = readUnsignedByte(in);
		ClspClassSource[] clspClassSources = ClspClassSource.values();
		if (source < 0 || source > clspClassSources.length) {
			throw new DecodeException("Wrong jadx source identifier: " + source);
		}
		return clspClassSources[source];
	}

	private List<ClspMethod> readClsMethods(DataInputStream in, ClassInfo clsInfo) throws IOException {
		int mCount = in.readShort();
		List<ClspMethod> methods = new ArrayList<>(mCount);
		for (int j = 0; j < mCount; j++) {
			methods.add(readMethod(in, clsInfo));
		}
		return methods;
	}

	private ClspMethod readMethod(DataInputStream in, ClassInfo clsInfo) throws IOException {
		String name = readString(in);
		List<ArgType> argTypes = readArgTypesList(in);
		ArgType retType = readArgType(in);
		List<ArgType> genericArgTypes = readArgTypesList(in);

View on GitHub (pinned to e738a26571)

Solutions

  1. Ensure the .jcst file was produced and consumed by the same jadx version — do not mix versions.
  2. If the bundled core.jcst is newer than the ClsSet.java class, rebuild jadx-core from the same commit so the enum and resource match.
  3. Update jadx to the latest version so ClspClassSource includes all source identifiers the file references.
  4. If maintaining a fork, add the missing ClspClassSource enum entries to match the file's identifiers.
Defensive patterns

Strategy: validation

Validate before calling

// Verify the file's source identifiers are within the known enum range
// This requires reading the source bytes from the stream, so typically done
// by ensuring version compatibility (see error 58) before loading.
int maxSourceOrd = ClspClassSource.values().length - 1; // currently 3
// If you can peek the source byte, check: source <= maxSourceOrd

Try / catch

try {
    clsSet.loadFromClstFile();
} catch (DecodeException e) {
    if (e.getMessage().startsWith("Wrong jadx source identifier:")) {
        throw new IllegalStateException(
            "The .jcst file references a ClspClassSource not known to this jadx version. "
            + "Update jadx to a newer release.", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Loading a .jcst file where the source ordinal byte is >= the number of ClspClassSource enum values. This happens if the file was written by a newer jadx that has more ClspClassSource entries (e.g., added a new framework JAR) than the loading version knows about. Note: the boundary check uses '>' instead of '>=', so source == length is an off-by-one that would cause ArrayIndexOutOfBoundsException instead — a minor code bug.

Common situations: A newer jadx writes a .jcst with a ClspClassSource ordinal (e.g., 4 or 5 for a newly added system JAR) that does not exist in the older running jadx's enum. Cross-version usage of .jcst files. The bundled core.jcst from a newer jadx used with an older jadx-core JAR.

Related errors


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