apache/cassandra · error · IllegalArgumentException

Keyspace and table of a dictionary to import (%s.%s) does no

Error message

Keyspace and table of a dictionary to import (%s.%s) does not correspond to the keyspace and table this manager is responsible for (%s.%s)

What it means

The imported dictionary's CompositeData carries its own keyspace and table names. importCompressionDictionary() rejects the payload with IllegalArgumentException when those names do not match the keyspace/table this manager instance is responsible for, preventing a dictionary trained for one table from being installed on another.

Source

Thrown at src/java/org/apache/cassandra/db/compression/CompressionDictionaryManager.java:276

        if (compressionDictionary == null)
            return null;

        return CompressionDictionaryDetailsTabularData.fromCompressionDictionary(keyspaceName, tableName, tableId, compressionDictionary);
    }

    @Override
    public synchronized void importCompressionDictionary(CompositeData compositeData)
    {
        if (!isEnabled || this.kind == null)
        {
            throw new IllegalStateException(format("The compression on table %s.%s is not enabled or SSTable compressor is not a dictionary compressor.",
                                                   keyspaceName, tableName));
        }

        CompressionDictionaryDataObject dataObject = CompressionDictionaryDetailsTabularData.fromCompositeData(compositeData);

        if (!keyspaceName.equals(dataObject.keyspace) || !tableName.equals(dataObject.table))
            throw new IllegalArgumentException(format("Keyspace and table of a dictionary to import (%s.%s) does not correspond to the keyspace and table this manager is responsible for (%s.%s)",
                                                      dataObject.keyspace, dataObject.table,
                                                      keyspaceName, tableName));

        CompressionDictionary.Kind kind = CompressionDictionary.Kind.valueOf(dataObject.kind);

        if (this.kind != kind)
        {
            throw new IllegalArgumentException(format("It is not possible to import compression dictionaries of kind " +
                                                      "%s into table %s.%s which supports compression dictionaries of kind %s.",
                                                      kind, keyspaceName, tableName, this.kind));
        }

        CompressionDictionary.DictId dictId = new CompressionDictionary.DictId(kind, dataObject.dictId);

        LightweightCompressionDictionary latestCompressionDictionary = retrieveLightweightLatestCompressionDictionary(keyspaceName, tableName, tableId);
        if (latestCompressionDictionary != null)
        {
            if (latestCompressionDictionary.dictId.id > dictId.id)

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Target the MBean/manager of the exact keyspace.table the dictionary came from.
  2. Re-export the dictionary with correct keyspace/table metadata matching the destination.
  3. Fix the keyspace and table fields in the CompressionDictionaryDataObject to match the target table (only if the dictionary truly belongs to it).
  4. Watch case sensitivity: quoted identifiers in CQL are case-sensitive.

Example fix

// before
// dictionary for ks.tbl1 imported into ks.tbl2's manager
ks2Manager.importCompressionDictionary(tbl1Data);
// after
MBeanServerConnection mbs = ...;
ObjectName on = new ObjectName("org.apache.cassandra.db:type=CompressionDictionaryManager,keyspace=ks,table=tbl1");
mbs.invoke(on, "importCompressionDictionary", new Object[]{tbl1Data}, new String[]{javax.management.openmbean.CompositeData.class.getName()});
Defensive patterns

Strategy: validation

Validate before calling

if (keyspace.equals(dataObject.keyspace) && table.equals(dataObject.table)) manager.importCompressionDictionary(data);

Try / catch

try { manager.importCompressionDictionary(data); } catch (IllegalArgumentException e) { /* wrong table: route to correct manager/MBean */ }

Prevention

When it happens

Trigger: Calling importCompressionDictionary with a CompositeData whose dataObject.keyspace or dataObject.table differs from the manager's keyspaceName/tableName — e.g. posting table A's dictionary to table B's MBean.

Common situations: Using the wrong JMX object name when importing; exporting a dictionary from one table and importing it into another; typos in keyspace/table names inside hand-built CompositeData; case-sensitivity mistakes with quoted identifiers.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/003c5bde1dd25a85. Report an issue: GitHub.