{"record":{"id":"ec467e02d500d1d9","repo":"apache/cassandra","slug":"s-compression-dictionary-is-not-created-for-dict","errorCode":null,"errorMessage":"%s compression dictionary is not created for dict id %s","messagePattern":"(.+?) compression dictionary is not created for dict id (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionary.java","lineNumber":289,"sourceCode":"        int size = row.getInt(\"dict_length\");\n        String keyspaceName = row.getString(\"keyspace_name\");\n        String tableName = row.getString(\"table_name\");\n        String tableId = row.getString(\"table_id\");\n        Instant createdAt = row.getTimestamp(\"created_at\").toInstant();\n\n        try\n        {\n            return new LightweightCompressionDictionary(keyspaceName,\n                                                        tableName,\n                                                        tableId,\n                                                        new DictId(CompressionDictionary.Kind.valueOf(kindStr), dictId),\n                                                        checksum,\n                                                        size,\n                                                        createdAt);\n        }\n        catch (IllegalArgumentException ex)\n        {\n            throw new IllegalStateException(kindStr + \" compression dictionary is not created for dict id \" + dictId);\n        }\n    }\n\n    static CompressionDictionary createFromRow(UntypedResultSet.Row row)\n    {\n        String kindStr = row.getString(\"kind\");\n        long dictId = row.getLong(\"dict_id\");\n        byte[] dict = row.getByteArray(\"dict\");\n        int storedLength = row.getInt(\"dict_length\");\n        int storedChecksum = row.getInt(\"dict_checksum\");\n        Instant createdAt = row.getTimestamp(\"created_at\").toInstant();\n\n        try\n        {\n            Kind kind = CompressionDictionary.Kind.valueOf(kindStr);\n\n            // Validate length\n            if (dict.length != storedLength)","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionary.java#L271-L307","documentation":"createFromRowLightweight builds a CompressionDictionary from a row of the dictionary system table by delegating to the Kind-specific factory. If the factory rejects the parameters with an IllegalArgumentException (e.g. dictionary bytes too small or invalid for the kind), it is converted to an IllegalStateException stating that no dictionary of that kind could be created for the given dict id.","triggerScenarios":"Loading a zstd (or other kind) dictionary from the system dictionary table where the stored bytes/size/checksum are not valid for the kind's createDictionary — commonly zero-length or truncated dictionary blobs.","commonSituations":"Partially written dictionary rows during crashes, corrupt storage, or version differences where a kind's validation rules changed.","solutions":["Delete the invalid dictionary row/file and allow the node to regenerate or re-fetch the dictionary.","Regenerate the zstd dictionary via the dictionary training mechanism and re-ingest it.","Verify integrity of the system table storage / underlying SSTables (nodetool scrub if needed).","Check for version skew between nodes that wrote and read the dictionary row."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// verify dictionary row sanity before use\nif (dictBytes == null || dictBytes.length == 0 || dictBytes.length != storedSize)\n    throw new IllegalStateException(\"dictionary row inconsistent for id \" + dictId);","typeGuard":null,"tryCatchPattern":"try {\n    d = createFromRowLightweight(row);\n} catch (IllegalStateException e) {\n    logger.warn(\"Falling back after invalid dictionary: {}\", e.getMessage());\n    d = defaultCompression();\n}","preventionTips":["Avoid killing nodes during dictionary ingestion; check logs for interrupted training","Repair/scrub system tables after hard crashes","Validate dictionary blobs (size + checksum) after restore operations"],"tags":["cassandra","compression","zstd-dictionary","state"],"backgroundTag":"internal-invariant-violation","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"}