apache/cassandra · error · RuntimeException

Not yet initialized, can't load new sstables

Error message

Not yet initialized, can't load new sstables

What it means

StorageService.loadNewSSTables() is a deprecated public entry point (CASSANDRA-14417) for bulk-loading existing SSTables into a table. The node throws this RuntimeException when the StorageService has not finished full startup/initialization (isInitialized() returns false), because sstable loading requires the ring, schema, and storage services to be up.

Source

Thrown at src/java/org/apache/cassandra/service/StorageService.java:4593

            }
        };

        return new SSTableLoader(dir, client, new OutputHandler.LogOutput()).stream();
    }

    public void rescheduleFailedDeletions()
    {
        LifecycleTransaction.rescheduleFailedDeletions();
    }

    /**
     * @deprecated See CASSANDRA-14417
     */
    @Deprecated(since = "4.0")
    public void loadNewSSTables(String ksName, String cfName)
    {
        if (!isInitialized())
            throw new RuntimeException("Not yet initialized, can't load new sstables");
        Keyspace.verifyKeyspaceIsValid(ksName);
        ColumnFamilyStore.loadNewSSTables(ksName, cfName);
    }

    /**
     * #{@inheritDoc}
     */
    public List<String> sampleKeyRange() // do not rename to getter - see CASSANDRA-4452 for details
    {
        List<DecoratedKey> keys = new ArrayList<>();
        for (Keyspace keyspace : Keyspace.nonLocalStrategy())
        {
            if (keyspace.getMetadata().params.replication.isMeta())
                continue;
            for (Range<Token> range : getPrimaryRangesForEndpoint(keyspace.getName(), getBroadcastAddressAndPort()))
                keys.addAll(keySamples(keyspace.getColumnFamilyStores(), range));
        }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Wait until the node is fully initialized before calling loadNewSSTables (poll StorageService.isInitialized() or check nodetool status returns normally).
  2. Retry the call after startup completes; wrap in a loop that waits for isInitialized().
  3. Use the JMX notification for 'Started' state or StorageService operation mode == NORMAL as the readiness signal.
  4. Prefer letting the node's own startup sstable scan handle the files instead of the deprecated loadNewSSTables API.

Example fix

// before
storageService.loadNewSSTables("ks", "tbl"); // throws if not initialized
// after
if (!storageService.isInitialized()) {
    throw new IllegalStateException("wait for node startup before loading sstables");
}
storageService.loadNewSSTables("ks", "tbl");
Defensive patterns

Strategy: validation

Validate before calling

if (!storageService.isInitialized()) { throw new IllegalStateException("node not ready; retry after startup"); }
storageService.loadNewSSTables(ksName, cfName);

Type guard

boolean ready = java.util.Optional.ofNullable(storageService).map(s -> s.isInitialized()).orElse(false);

Try / catch

try { storageService.loadNewSSTables(ks, cf); } catch (RuntimeException e) { if (!storageService.isInitialized()) { /* retry after startup */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling StorageService.loadNewSSTables(ksName, cfName) programmatically or via JMX/nodetool before the node has completed initialization (e.g., during startup, while still in STARTING state, or on an uninitialized embedded instance).

Common situations: Automation scripts or JMX clients firing loadNewSSTables too early after a node restart; embedded/test harnesses invoking the API before StorageService.initServer(); monitoring tools racing node boot.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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