apache/cassandra · warning
Error loading key or row cache
Error message
Error loading key or row cache
What it means
Warning logged during CassandraDaemon.setup when asynchronous loading of the key and/or row cache from disk fails. JVMStabilityInspector.inspectThrowable decides whether the failure is fatal (e.g. disk corruption usually is); otherwise the node continues with cold caches.
Source
Thrown at src/java/org/apache/cassandra/service/CassandraDaemon.java:340
}
// We need to persist this as soon as possible after startup checks.
// This should be the first write to SystemKeyspace (CASSANDRA-11742)
SystemKeyspace.persistLocalMetadata();
Thread.setDefaultUncaughtExceptionHandler(JVMStabilityInspector::uncaughtException);
SystemKeyspaceMigrator41.migrate();
setupVirtualKeyspaces();
try
{
loadRowAndKeyCacheAsync().get();
}
catch (Throwable t)
{
JVMStabilityInspector.inspectThrowable(t);
logger.warn("Error loading key or row cache", t);
}
if (!SKIP_GC_INSPECTOR)
{
try
{
GCInspector.register();
}
catch (Throwable t)
{
JVMStabilityInspector.inspectThrowable(t);
logger.warn("Unable to start GCInspector (currently only supported on the Sun JVM)");
}
}
// Replay any CommitLogSegments found on disk
PaxosState.initializeTrackers();
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Inspect the chained exception for the offending cache file and delete/clear the corrupt cache files from saved_caches_directory, then restart (node starts with cold cache)
- Check filesystem permissions and disk health (dmesg, smartctl) for the cache directory volume
- Verify cache settings in cassandra.yaml (key_cache_size_in_mb, row_cache_size_in_mb, saved_caches_directory) are consistent with the on-disk files
- If corruption recurs, disable the row cache or resize caches to reduce exposure
Defensive patterns
Strategy: fallback
Validate before calling
// before start: check cache dir readable and files intact ls -la /var/lib/cassandra/saved_caches # and inspect any *.db cache files for truncation (size > 0, no partial temp files)
Try / catch
try {
loadRowAndKeyCacheAsync().get();
} catch (Throwable t) {
JVMStabilityInspector.inspectThrowable(t);
logger.warn("Error loading key or row cache", t);
// accept cold cache, or remove corrupt saved_caches files and restart
} Prevention
- Monitor disk space on the saved_caches volume
- Use clean shutdowns (nodetool drain) to avoid truncated cache files
- Check saved_caches directory permissions after OS upgrades
- Investigate root cause via the chained exception rather than deleting files blindly
When it happens
Trigger: loadRowAndKeyCacheAsync().get() throws: cache files under saved_caches_directory are corrupt, unreadable (permissions), or the cache size config mismatches; disk I/O error while reading cache files; an InterruptedException during the blocking get().
Common situations: Corrupt or truncated saved_caches files after an unclean shutdown or disk-full event; wrong permissions on the saved_caches directory; moving cache files between nodes/versions; disk hardware failures.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Error loading counter cache
- Cache schema version + expected + does not match current sch
- Cannot find configured row cache provider class ${DatabaseDe
- Corrupted key cache. Key length of %d is longer than maximum
- Corrupted key cache. Failed to deserialize key of key cache
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/539ee30f9ce8e933.
Report an issue: GitHub.