apache/cassandra · error · IllegalArgumentException

Invalid target size for SSTables, must be > 0

Error message

Invalid target size for SSTables, must be > 0 (got: %s)

What it means

IllegalArgumentException thrown by the SplittingCompactionTask constructor when the target SSTable size given to nodetool's sstablesplit / SSTableSplitter is zero or negative. The splitter compacts SSTables down to a target size, so a non-positive target is meaningless and the task refuses to run. This is a programming/CLI argument validation error, not a runtime state issue.

Solutions

  1. Pass a positive target size in MiB (e.g. 50 or 100) to the split operation.
  2. Check any script/config that computes sstableSizeInMB for unit conversion or empty-string-to-0 parsing bugs.
  3. Add a caller-side check (size > 0) before invoking the split API to fail fast with a clearer message.

Example fix

// before
int sizeInMb = Integer.parseInt(configValue); // "" -> NumberFormatException, "0" -> 0
new SSTableSplitter(cfs, txn, sizeInMb);
// after
int sizeInMb = Integer.parseInt(configValue.trim());
if (sizeInMb <= 0) throw new IllegalArgumentException("sstable size must be > 0, got: " + configValue);
new SSTableSplitter(cfs, txn, sizeInMb);
Defensive patterns

Strategy: validation

Validate before calling

if (sstableSizeInMB <= 0) throw new IllegalArgumentException("sstableSizeInMB must be > 0, got: " + sstableSizeInMB);

Try / catch

try { store.sstableSplit(sizeInMb); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Invalid target size")) { /* fix size and retry with a positive value */ } else throw e; }

Prevention

When it happens

Trigger: Calling ColumnFamilyStore.sstableSplit or the SSTableSplitter API with sstableSizeInMB <= 0 (e.g. 0 or a negative int), typically via a negative value passed to the nodetool sstable_splitter style invocation or an internal caller that computes the size from uninitialized/config data.

Common situations: Administrators scripting nodetool pass a computed size that evaluates to 0 or negative (unit-conversion bug, empty config value parsed as 0); tooling wraps the JMX operation and passes a placeholder value before reading real config.

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/e193b684ea1799dd. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java:55

        this.task = new SplittingCompactionTask(cfs, transaction, sstableSizeInMB);
    }

    public void split()
    {
        task.execute(ActiveCompactionsTracker.NOOP);
    }

    public static class SplittingCompactionTask extends CompactionTask
    {
        private final int sstableSizeInMiB;

        public SplittingCompactionTask(ColumnFamilyStore cfs, ILifecycleTransaction transaction, int sstableSizeInMB)
        {
            super(cfs, transaction, CompactionManager.NO_GC, false);
            this.sstableSizeInMiB = sstableSizeInMB;

            if (sstableSizeInMB <= 0)
                throw new IllegalArgumentException("Invalid target size for SSTables, must be > 0 (got: " + sstableSizeInMB + ")");
        }

        @Override
        protected CompactionController getCompactionController(Set<SSTableReader> toCompact, long gcBefore)
        {
            return new SplitController(cfs);
        }

        @Override
        public CompactionAwareWriter getCompactionAwareWriter(ColumnFamilyStore cfs,
                                                              Directories directories,
                                                              ILifecycleTransaction txn,
                                                              Set<SSTableReader> nonExpiredSSTables)
        {
            return new MaxSSTableSizeWriter(cfs, directories, txn, nonExpiredSSTables, sstableSizeInMiB * 1024L * 1024L, 0, false);
        }

        @Override

View on GitHub (pinned to 88fd0f6a0e)