{"record":{"id":"dffe995e3d5792d7","repo":"apache/cassandra","slug":"invalid-sstable-file-name-invalid-version-s","errorCode":null,"errorMessage":"Invalid sstable file ${name}: invalid version %s","messagePattern":"Invalid sstable file (.+?): invalid version (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/io/sstable/Descriptor.java","lineNumber":421,"sourceCode":"            // old format sstable, which had the format:\n            //   <keyspace>-<table>-(tmp-)?<version>-<gen>-<component>\n            // Note that we assume it's an old format sstable if it has the right number of tokens: this is not perfect\n            // but we're just trying to be helpful, not perfect.\n            if (size == 5 || size == 6)\n                throw new IllegalArgumentException(String.format(\"%s is of version %s which is now unsupported and cannot be read.\", name, tokens.get(size - 3)));\n            throw new IllegalArgumentException(String.format(\"Invalid sstable file %s: the name doesn't look like a supported sstable file name\", name));\n        }\n        return tokens;\n    }\n\n    private static SSTableInfo validateAndExtractInfo(File file)\n    {\n        String name = file.name();\n        List<String> tokens = filenameTokens(name);\n\n        String versionString = tokens.get(0);\n        if (!Version.validate(versionString))\n            throw invalidSSTable(name, \"invalid version %s\", versionString);\n\n        SSTableId id;\n        try\n        {\n            id = SSTableIdFactory.instance.fromString(tokens.get(1));\n        }\n        catch (RuntimeException e)\n        {\n            throw invalidSSTable(name, \"the 'id' part (%s) of the name doesn't parse as a valid unique identifier\", tokens.get(1));\n        }\n\n        SSTableFormat<?, ?> format = formatFromName(name, tokens);\n        Component component = Component.parse(tokens.get(3), format);\n\n        Version version = format.getVersion(versionString);\n        if (!version.isCompatible())\n            throw invalidSSTable(name, \"incompatible sstable version (%s); you should have run upgradesstables before upgrading\", versionString);\n","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/Descriptor.java#L403-L439","documentation":"SSTable filenames begin with a version token (e.g. 'ka', 'mc', 'md'). validateAndExtractInfo extracts token 0 and validates it via Version.validate; on failure this invalidSSTable exception is thrown. It means the first filename token is not a known sstable format version, so the file cannot be attributed to any readable version.","triggerScenarios":"Descriptor.info(file)/fromFilename on a file whose first name token is not a valid version string — corrupted filenames, files renamed without preserving the version token, or files from a much newer/unknown version.","commonSituations":"Hand-edited sstable names during manual repairs; files placed in a table directory that don't belong (foreign artifacts); restoring data from a newer major version into an older node.","solutions":["Check the filename and restore the correct version token if it was renamed or corrupted.","Verify the file actually is a Cassandra sstable component (naming scheme: version-id-generation-format-component).","Upgrade Cassandra if the file was written by a newer version whose version string this build rejects.","Remove foreign/corrupt files from the data directory and let a repair/refresh regenerate data."],"exampleFix":"// before\nmytable-xy7f_0abc_1big-Data.db   // 'xy7f' is not a version token\n// after\nmc-1-big-Data.db                  // valid version token ('mc') as first part","handlingStrategy":"validation","validationCode":"String versionToken = filename.split(\"-\")[0];\nif (!Version.validate(versionToken))\n    throw new IllegalStateException(\"Not a valid sstable version token: \" + versionToken);","typeGuard":null,"tryCatchPattern":"try { Descriptor.Info info = Descriptor.fromFilename(file); }\ncatch (Throwable e) { if (e.getMessage() != null && e.getMessage().contains(\"invalid version\")) { /* fix filename or upgrade version */ } else throw e; }","preventionTips":["Never rename sstable files manually; version tokens must be preserved.","Verify files are genuine Cassandra sstable components before loading.","Upgrade nodes before ingesting sstables written by newer versions.","Keep only current-format files in table data directories."],"tags":["sstable","descriptor","version","filename-parsing"],"backgroundTag":"invalid-identifier-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}