{"record":{"id":"669bdb1de5ab4bb7","repo":"apache/cassandra","slug":"unknown-commitlog-version","errorCode":null,"errorMessage":"Unknown commitlog version ","messagePattern":"Unknown commitlog version ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java","lineNumber":232,"sourceCode":"            throw new UnsupportedOperationException(\"Commitlog segment is too old to open; upgrade to 1.2.5+ first\");\n\n        return matcher;\n    }\n\n    public int getMessagingVersion()\n    {\n        switch (version)\n        {\n            case VERSION_30:\n                return MessagingService.VERSION_30;\n            case VERSION_40:\n                return MessagingService.VERSION_40;\n            case VERSION_50:\n                return MessagingService.VERSION_50;\n            case VERSION_60:\n                return MessagingService.VERSION_60;\n            default:\n                throw new IllegalStateException(\"Unknown commitlog version \" + version);\n        }\n    }\n\n    public String fileName()\n    {\n        return FILENAME_PREFIX + version + SEPARATOR + id + FILENAME_EXTENSION;\n    }\n\n    public String cdcIndexFileName()\n    {\n        return FILENAME_PREFIX + version + SEPARATOR + id + INDEX_FILENAME_SUFFIX;\n    }\n\n    /**\n     * Infer the corresponding cdc index file using its cdc commitlog file\n     * @param cdcCommitLogSegment\n     * @return cdc index file or null if the cdc index file cannot be inferred.\n     */","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java#L214-L250","documentation":"CommitLogDescriptor.getMessagingVersion maps the commit log format version to the internal MessagingService version used when replaying mutations. If the descriptor's version is not one of the known VERSION_* constants, the switch falls through to default and throws an IllegalStateException 'Unknown commitlog version <version>'.","triggerScenarios":"shouldSkipSegmentId or readMutation during commit log replay encountering a descriptor whose version field is not a recognized CommitLogDescriptor.VERSION_* value — typically a version from a newer release than this build.","commonSituations":"A newer-version segment slipping into replay (e.g. after a downgrade without cleaning commitlogs), corrupted header bytes producing a bogus version int, or hand-crafted/forged segment files in tests.","solutions":["Remove or replay the segments with the Cassandra version that wrote them (usually the newest one), then downgrade cleanly.","Check descriptor.version in the failing segment name (it is embedded in the file name) and compare against this build's supported versions.","If the file is corrupted, delete it from the commitlog directory and restore from backup.","Upgrade this node to a release that recognizes the version constant."],"exampleFix":"// before: 5.0-written segment replayed by a 4.0 binary -> IllegalStateException('Unknown commitlog version 50')\n// after: drain/flush on the 5.0 node (nodetool drain) before downgrading, and clear commitlog_directory","handlingStrategy":"try-catch","validationCode":"String v = name.replaceAll(\"^CommitLog([0-9]+)-.*\", \"$1\");\nif (Integer.parseInt(v) > CommitLogDescriptor.current_version)\n    logger.warn(\"Segment {} uses unknown version {} on this build\", name, v);","typeGuard":null,"tryCatchPattern":"try { replay(descriptor); } catch (IllegalStateException e) { logger.error(\"Replay failed: {}\", e.getMessage()); /* drain on correct version then retry */ }","preventionTips":["Always run nodetool drain before downgrading","Clear commitlog_directory when switching node versions","Check segment file names (version embedded) before replay"],"tags":["commitlog","version-mismatch","replay"],"backgroundTag":"unsupported-enum-value","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"}