{"record":{"id":"2ebd14cba893be42","repo":"apache/cassandra","slug":"unsupported-pre-3-0-commit-log-found-cannot-read","errorCode":null,"errorMessage":"Unsupported pre-3.0 commit log found; cannot read.","messagePattern":"Unsupported pre-3\\.0 commit log found; cannot read\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java","lineNumber":157,"sourceCode":"        {\n            return readHeader(raf, encryptionContext);\n        }\n        catch (EOFException e)\n        {\n            throw new RuntimeException(e);\n        }\n        catch (IOException e)\n        {\n            throw new FSReadError(e, file);\n        }\n    }\n\n    public static CommitLogDescriptor readHeader(DataInput input, EncryptionContext encryptionContext) throws IOException\n    {\n        CRC32 checkcrc = new CRC32();\n        int version = input.readInt();\n        if (version < VERSION_30)\n            throw new IllegalArgumentException(\"Unsupported pre-3.0 commit log found; cannot read.\");\n\n        updateChecksumInt(checkcrc, version);\n        long id = input.readLong();\n        updateChecksumInt(checkcrc, (int) (id & 0xFFFFFFFFL));\n        updateChecksumInt(checkcrc, (int) (id >>> 32));\n        int parametersLength = input.readShort() & 0xFFFF;\n        updateChecksumInt(checkcrc, parametersLength);\n        // This should always succeed as parametersLength cannot be too long even for a\n        // corrupt segment file.\n        byte[] parametersBytes = new byte[parametersLength];\n        input.readFully(parametersBytes);\n        checkcrc.update(parametersBytes, 0, parametersBytes.length);\n        int crc = input.readInt();\n\n        if (crc == (int) checkcrc.getValue())\n        {\n            Map<?, ?> map = (Map<?, ?>) JsonUtils.decodeJson(parametersBytes);\n            return new CommitLogDescriptor(version, id, parseCompression(map), EncryptionContext.createFromMap(map, encryptionContext));","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java#L139-L175","documentation":"CommitLogDescriptor.readHeader reads the first int of a segment file as the version. Any version below VERSION_30 comes from a Cassandra older than 3.0, whose header layout and encodings are no longer supported, so an IllegalArgumentException is thrown. Only 3.0+ segment formats can be read.","triggerScenarios":"readHeader (via CommitLogDescriptor.fromHeader) opening a commit log segment whose stored version int is < VERSION_30 — i.e. a segment file written by Cassandra 2.x or older, or a corrupted/garbage file whose first bytes parse as a small integer.","commonSituations":"Upgrading an old node without first replaying/flushing pre-3.0 commit logs, restoring an ancient backup of commitlogs, or pointing Cassandra at a directory containing unrelated or truncated files.","solutions":["Start the intermediate Cassandra 3.0/3.x version once to replay and flush the old commit logs, then upgrade further; never jump versions with old logs in place.","Delete or move the pre-3.0 segment files out of the commitlog directory after confirming they are not needed.","Restore data from snapshots/backup instead of replaying ancient commit logs.","If the file is corrupt rather than genuinely old, remove it from the commitlog directory."],"exampleFix":"// before: copying Cassandra-2.2 commitlog-*.log into a 4.x data dir -> IllegalArgumentException\n// after\n// 1) run Cassandra 3.0.x against the old data dir (replays logs), nodetool drain\n// 2) then upgrade to 4.x","handlingStrategy":"validation","validationCode":"int version = peekFirstInt(segmentFile);\nif (version < CommitLogDescriptor.VERSION_30)\n    logger.warn(\"{} is a pre-3.0 commit log; replay it on 3.0.x first\", segmentFile);","typeGuard":null,"tryCatchPattern":"try { CommitLogDescriptor.fromHeader(input, ctx); } catch (IllegalArgumentException e) { logger.error(\"Old/incompatible segment: {}\", e.getMessage()); /* remove or upgrade first */ }","preventionTips":["Always follow the documented multi-step upgrade path","Drain/flush commit logs before each major upgrade","Never copy pre-3.0 commitlog files into a modern data directory"],"tags":["commitlog","version-mismatch","upgrade","legacy"],"backgroundTag":"unsupported-version","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}