{"record":{"id":"e3cca52b0e5a0500","repo":"skylot/jadx","slug":"wrong-jadx-source-identifier","errorCode":null,"errorMessage":"Wrong jadx source identifier: ","messagePattern":"Wrong jadx source identifier: ","errorType":"exception","errorClass":"DecodeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/clsp/ClsSet.java","lineNumber":342,"sourceCode":"\t\t\t\tClspClassSource clsSource = readClsSource(in);\n\t\t\t\tString name = readString(in);\n\t\t\t\tclasses[i] = new ClspClass(ArgType.object(name), i, accFlags, clsSource);\n\t\t\t}\n\t\t\tfor (int i = 0; i < clsCount; i++) {\n\t\t\t\tClspClass nClass = classes[i];\n\t\t\t\tClassInfo clsInfo = ClassInfo.fromType(root, nClass.getClsType());\n\t\t\t\tnClass.setParents(readArgTypesArray(in));\n\t\t\t\tnClass.setTypeParameters(readArgTypesList(in));\n\t\t\t\tnClass.setMethods(readClsMethods(in, clsInfo));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static ClspClassSource readClsSource(DataInputStream in) throws IOException, DecodeException {\n\t\tint source = readUnsignedByte(in);\n\t\tClspClassSource[] clspClassSources = ClspClassSource.values();\n\t\tif (source < 0 || source > clspClassSources.length) {\n\t\t\tthrow new DecodeException(\"Wrong jadx source identifier: \" + source);\n\t\t}\n\t\treturn clspClassSources[source];\n\t}\n\n\tprivate List<ClspMethod> readClsMethods(DataInputStream in, ClassInfo clsInfo) throws IOException {\n\t\tint mCount = in.readShort();\n\t\tList<ClspMethod> methods = new ArrayList<>(mCount);\n\t\tfor (int j = 0; j < mCount; j++) {\n\t\t\tmethods.add(readMethod(in, clsInfo));\n\t\t}\n\t\treturn methods;\n\t}\n\n\tprivate ClspMethod readMethod(DataInputStream in, ClassInfo clsInfo) throws IOException {\n\t\tString name = readString(in);\n\t\tList<ArgType> argTypes = readArgTypesList(in);\n\t\tArgType retType = readArgType(in);\n\t\tList<ArgType> genericArgTypes = readArgTypesList(in);","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/clsp/ClsSet.java#L324-L360","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the .jcst file was produced and consumed by the same jadx version — do not mix versions.","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.","Update jadx to the latest version so ClspClassSource includes all source identifiers the file references.","If maintaining a fork, add the missing ClspClassSource enum entries to match the file's identifiers."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the file's source identifiers are within the known enum range\n// This requires reading the source bytes from the stream, so typically done\n// by ensuring version compatibility (see error 58) before loading.\nint maxSourceOrd = ClspClassSource.values().length - 1; // currently 3\n// If you can peek the source byte, check: source <= maxSourceOrd","typeGuard":null,"tryCatchPattern":"try {\n    clsSet.loadFromClstFile();\n} catch (DecodeException e) {\n    if (e.getMessage().startsWith(\"Wrong jadx source identifier:\")) {\n        throw new IllegalStateException(\n            \"The .jcst file references a ClspClassSource not known to this jadx version. \"\n            + \"Update jadx to a newer release.\", e);\n    }\n    throw e;\n}","preventionTips":["Ensure the .jcst file is produced and consumed by the same jadx version.","Update jadx to the latest release so ClspClassSource includes all framework JAR identifiers.","If maintaining a fork, add missing ClspClassSource enum entries to match newer .jcst files."],"tags":["classpath","clst","decode","enum","version"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}