{"record":{"id":"c4f9c7493c329301","repo":"apache/cassandra","slug":"unknown-compression","errorCode":null,"errorMessage":"Unknown compression","messagePattern":"Unknown compression","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java","lineNumber":309,"sourceCode":"                    throw new IllegalStateException(String.format(\"Cannot safely construct descriptor for segment, as name and header descriptors do not match (%s vs %s): %s\", fromHeader, fromName, fromFile.path()));\n                else if (fromName != null && fromHeader == null)\n                    throw new IllegalStateException(\"Cannot safely construct descriptor for segment, as name descriptor implies a version that should contain a header descriptor, but that descriptor could not be read: \" + fromFile.path());\n                else if (fromHeader != null)\n                    descriptor = fromHeader;\n                else descriptor = fromName;\n\n                if (descriptor.version > CommitLogDescriptor.current_version)\n                    throw new IllegalStateException(\"Unsupported commit log version: \" + descriptor.version);\n\n                if (descriptor.compression != null)\n                {\n                    try\n                    {\n                        CompressionParams.createCompressor(descriptor.compression);\n                    }\n                    catch (ConfigurationException e)\n                    {\n                        throw new IllegalStateException(\"Unknown compression\", e);\n                    }\n                }\n\n                File toFile = new File(DatabaseDescriptor.getCommitLogLocation(), descriptor.fileName());\n                if (toFile.exists())\n                {\n                    if (logger.isTraceEnabled())\n                        logger.trace(\"Skipping restore of archive {} as the segment already exists in the restore location {}\",\n                                     fromFile.path(), toFile.path());\n                    continue;\n                }\n\n                String command = FROM.matcher(restoreCommand).replaceAll(Matcher.quoteReplacement(fromFile.path()));\n                command = TO.matcher(command).replaceAll(Matcher.quoteReplacement(toFile.path()));\n                try\n                {\n                    exec(command);\n                }","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java#L291-L327","documentation":"When restoring an archived commit log segment, the descriptor read from its header can specify a compressor (e.g. LZ4, Snappy). CommitLogArchiver calls CompressionParams.createCompressor to instantiate it; if the class name cannot be resolved or configured, the ConfigurationException is wrapped in an IllegalStateException with message 'Unknown compression'. The segment cannot be replayed without the compressor.","triggerScenarios":"maybeRestoreArchive reads a segment descriptor whose header carries a compression parameters string naming a compressor class that is not on the classpath or is misspelled/renamed, so CompressionParams.createCompressor throws ConfigurationException.","commonSituations":"Restoring archives written by a build with a custom/patched compression codec, classpath missing the codec library after an upgrade, or manually edited compression settings in the descriptor-carrying segment.","solutions":["Install/restore the compressor library (and class) that the segment header names so createCompressor succeeds.","Confirm the archive came from a stock Cassandra build; custom codecs are not portable across installations.","Skip/exclude the affected segment from the restore and replay from another archive or accept the data loss for that segment.","Upgrade to a Cassandra version where the codec name used by the source cluster exists."],"exampleFix":"// before: archive uses compressor 'Compressor7' not present on this node -> IllegalStateException('Unknown compression')\n// after: restore original segment from a node using a supported codec, or add the codec's jar to the classpath before restart","handlingStrategy":"validation","validationCode":"CommitLogDescriptor d = CommitLogDescriptor.fromFileName(segment.getName());\nif (d != null && d.compression != null) {\n    try { CompressionParams.createCompressor(d.compression); }\n    catch (ConfigurationException e) { logger.error(\"Missing compressor {} for {}\", d.compression, segment); }\n}","typeGuard":null,"tryCatchPattern":"try { archiver.maybeRestoreArchive(); } catch (IllegalStateException e) { logger.error(\"Cannot restore segment: {}\", e.getMessage()); }","preventionTips":["Avoid custom compression codecs on production commit logs","Keep the compression library jars on the classpath of every restore target","Verify archives replay on a test node before relying on them"],"tags":["commitlog","compression","restore","classpath"],"backgroundTag":"missing-dependency","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"}