{"record":{"id":"d69b457976b9a880","repo":"skylot/jadx","slug":"wrong-jadx-class-set-version-got","errorCode":null,"errorMessage":"Wrong jadx class set version, got: ","messagePattern":"Wrong jadx class set version, got: ","errorType":"exception","errorClass":"DecodeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/clsp/ClsSet.java","lineNumber":317,"sourceCode":"\t\t} else if (argType.isArray()) {\n\t\t\tout.writeByte(TypeEnum.ARRAY.ordinal());\n\t\t\twriteArgType(out, argType.getArrayElement(), names);\n\t\t} else {\n\t\t\tthrow new JadxRuntimeException(\"Cannot save type: \" + argType);\n\t\t}\n\t}\n\n\tprivate void load(InputStream input) throws IOException, DecodeException {\n\t\ttry (DataInputStream in = new DataInputStream(new BufferedInputStream(input))) {\n\t\t\tbyte[] header = new byte[JADX_CLS_SET_HEADER.length()];\n\t\t\tint readHeaderLength = in.read(header);\n\t\t\tif (readHeaderLength != JADX_CLS_SET_HEADER.length()\n\t\t\t\t\t|| !JADX_CLS_SET_HEADER.equals(new String(header, STRING_CHARSET))) {\n\t\t\t\tthrow new DecodeException(\"Wrong jadx class set header\");\n\t\t\t}\n\t\t\tint version = in.readByte();\n\t\t\tif (version != VERSION) {\n\t\t\t\tthrow new DecodeException(\"Wrong jadx class set version, got: \" + version + \", expect: \" + VERSION);\n\t\t\t}\n\t\t\tandroidApiLevel = in.readInt();\n\t\t\tint clsCount = in.readInt();\n\t\t\tclasses = new ClspClass[clsCount];\n\t\t\tfor (int i = 0; i < clsCount; i++) {\n\t\t\t\tint accFlags = in.readInt();\n\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}","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/clsp/ClsSet.java#L299-L335","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the jadx-core JAR and its bundled core.jcst resource are from the same release — rebuild from the same source tree.","Check dependency resolution for conflicting jadx-core versions (use gradle dependencies or mvn dependency:tree) and force a single version.","If loading a user .jcst, regenerate it using ClsSet.save from the same jadx version that will later load it.","Report the expected vs. got version numbers from the error message to confirm the mismatch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the version byte after the header before full load\ntry (InputStream check = Files.newInputStream(path)) {\n    byte[] headerAndVersion = new byte[9];\n    int read = check.read(headerAndVersion);\n    if (read == 9) {\n        int version = headerAndVersion[8] & 0xFF;\n        if (version != 5) { // ClsSet.VERSION\n            throw new IllegalArgumentException(\n                \"Version mismatch: file has \" + version + \", expected 5\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    clsSet.loadFromClstFile();\n} catch (DecodeException e) {\n    if (e.getMessage().startsWith(\"Wrong jadx class set version\")) {\n        throw new IllegalStateException(\n            \"The .jcst file version is incompatible with this jadx version. \"\n            + \"Ensure jadx-core JAR and core.jcst are from the same release.\", e);\n    }\n    throw e;\n}","preventionTips":["Ensure the jadx-core JAR and its bundled core.jcst are from the same release build.","Check for conflicting jadx-core versions in the dependency tree and force a single version.","Regenerate user .jcst files with the same jadx version that will load them."],"tags":["classpath","clst","version","serialization","decode"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}