apache/cassandra · error · RuntimeException
Failed importing SSTables
Error message
Failed importing SSTables
What it means
When moving/copying imported SSTables into the live data directory fails, SSTableImporter.importNewSSTables logs the failure and throws RuntimeException 'Failed importing SSTables' with the cause, aborting that directory's import. The rename/move of the prepared SSTables into place did not succeed.
Source
Thrown at src/java/org/apache/cassandra/db/SSTableImporter.java:206
{
logger.error("[{}] Failed importing sstables in directory {}", importID, dir, t);
failedDirectories.add(dir);
if (options.copyData)
{
removeCopiedSSTables(movedSSTables);
}
else
{
moveSSTablesBack(movedSSTables);
}
movedSSTables.clear();
newSSTablesPerDirectory.clear();
break;
}
else
{
logger.error("[{}] Failed importing sstables from data directory - renamed SSTables are: {}", importID, movedSSTables, t);
throw new RuntimeException("Failed importing SSTables", t);
}
}
}
newSSTables.addAll(newSSTablesPerDirectory);
}
if (newSSTables.isEmpty())
{
logger.info("[{}] No new SSTables were found for {}/{}", importID, cfs.getKeyspaceName(), cfs.getTableName());
return failedDirectories;
}
logger.info("[{}] Loading new SSTables and building secondary indexes for {}/{}: {}", importID, cfs.getKeyspaceName(), cfs.getTableName(), newSSTables);
if (logger.isTraceEnabled())
logLeveling(importID, newSSTables);
try (Refs<SSTableReader> refs = Refs.ref(newSSTables))
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Free disk space on the target data directory and retry the import
- Run the import so staging and the data directory share the same filesystem (rename must be same-device)
- Remove stale/partial files from previous failed imports in both the import and data directories, then retry
- Fix file ownership/permissions so the Cassandra user can write into the table's data directory
Example fix
// before: import dir on a different filesystem than data dir nodetool import -- ks table /mnt/usb/import # cross-device move fails // after: stage on same filesystem as data mkdir /var/lib/cassandra/data/import && cp /mnt/usb/import/* /var/lib/cassandra/data/import/ nodetool import -- ks table /var/lib/cassandra/data/import
Defensive patterns
Strategy: validation
Validate before calling
// preflight before import assertSameFilesystem(importDir, tableDataDir); requireFreeSpace(tableDataDir, sizeOf(importDir) * 1.2); requireWritableBy(tableDataDir, cassandraUser);
Prevention
- Keep the import directory on the same filesystem as the table's data directory
- Ensure ample free space (import roughly doubles the data temporarily)
- Clean leftovers of failed imports before retrying
- Run nodetool import as the Cassandra user with correct permissions
When it happens
Trigger: importNewSSTables moves verified, renamed SSTables from the staging/import directory to the table's data directory; an I/O error (disk full, permission denied, cross-device rename, existing target files) occurs and the directory is not a designated failed directory.
Common situations: Insufficient disk space on the target data volume; import directory on a different filesystem than the data directory; leftover files from a previous failed import with the same names; permission mismatch between the importer process and Cassandra's data dirs.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Failed to import sstable <filename>
- FSReadError (wraps IOException reading TOC file)
- Exception occurred while writing to
- Corrupt flags value for clustering prefix (isStatic flag set
- Corrupted sstable. Invalid flags found deserializing Deletio
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/58964a3f62762b6f.
Report an issue: GitHub.