{"record":{"id":"539ee30f9ce8e933","repo":"apache/cassandra","slug":"error-loading-key-or-row-cache","errorCode":null,"errorMessage":"Error loading key or row cache","messagePattern":"Error loading key or row cache","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/service/CassandraDaemon.java","lineNumber":340,"sourceCode":"        }\n\n        // We need to persist this as soon as possible after startup checks.\n        // This should be the first write to SystemKeyspace (CASSANDRA-11742)\n        SystemKeyspace.persistLocalMetadata();\n\n        Thread.setDefaultUncaughtExceptionHandler(JVMStabilityInspector::uncaughtException);\n\n        SystemKeyspaceMigrator41.migrate();\n        setupVirtualKeyspaces();\n\n        try\n        {\n            loadRowAndKeyCacheAsync().get();\n        }\n        catch (Throwable t)\n        {\n            JVMStabilityInspector.inspectThrowable(t);\n            logger.warn(\"Error loading key or row cache\", t);\n        }\n\n        if (!SKIP_GC_INSPECTOR)\n        {\n            try\n            {\n                GCInspector.register();\n            }\n            catch (Throwable t)\n            {\n                JVMStabilityInspector.inspectThrowable(t);\n                logger.warn(\"Unable to start GCInspector (currently only supported on the Sun JVM)\");\n            }\n        }\n\n        // Replay any CommitLogSegments found on disk\n        PaxosState.initializeTrackers();\n","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/CassandraDaemon.java#L322-L358","documentation":"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.","triggerScenarios":"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().","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before start: check cache dir readable and files intact\nls -la /var/lib/cassandra/saved_caches\n# and inspect any *.db cache files for truncation (size > 0, no partial temp files)","typeGuard":null,"tryCatchPattern":"try {\n    loadRowAndKeyCacheAsync().get();\n} catch (Throwable t) {\n    JVMStabilityInspector.inspectThrowable(t);\n    logger.warn(\"Error loading key or row cache\", t);\n    // accept cold cache, or remove corrupt saved_caches files and restart\n}","preventionTips":["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"],"tags":["cache","disk","startup"],"backgroundTag":"file-read-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}