apache/cassandra · warning
Could not list files in {}
Error message
Could not list files in {} What it means
deleteOldCacheFiles tries to list the saved_caches directory to purge stale cache files. If the directory listing itself fails (File[] listing returns null or throws), Cassandra logs this warning with the directory path and skips cleanup entirely. Cache save/load elsewhere may still work, but old files will accumulate.
Source
Thrown at src/java/org/apache/cassandra/cache/AutoSavingCache.java:459
if (files != null)
{
String cacheNameFormat = String.format("%s-%s.db", cacheType.toString(), CURRENT_VERSION);
for (File file : files)
{
if (!file.isFile())
continue; // someone's been messing with our directory. naughty!
if (file.name().endsWith(cacheNameFormat)
|| file.name().endsWith(cacheType.toString()))
{
if (!file.tryDelete())
logger.warn("Failed to delete {}", file.absolutePath());
}
}
}
else
{
logger.warn("Could not list files in {}", savedCachesDir);
}
}
public boolean isGlobal()
{
return false;
}
}
/**
* A base cache serializer that is used to serialize/deserialize a cache to/from disk.
* <p>
* It expects the following lifecycle:
* Serializations:
* 1. {@link #serialize(CacheKey, DataOutputPlus, ColumnFamilyStore)} is called for each key in the cache.
* 2. {@link #serializeMetadata(DataOutputPlus)} is called to serialize any metadata.
* 3. {@link #cleanupAfterSerialize()} is called to clean up any resources allocated for serialization.
* <p>View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Create the directory with correct ownership: mkdir -p <saved_caches_dir> && chown cassandra:cassandra <saved_caches_dir> && chmod 755 <saved_caches_dir>.
- Verify cassandra.yaml's saved_caches location matches an existing, writable path.
- Check filesystem mount/health (df -h, mount, dmesg) and fix a full or read-only volume.
- Restart Cassandra after fixing; stale cache files are safe to delete while the node is down.
Example fix
// before (cassandra.yaml) pointing to a missing dir saved_caches_directory: /var/lib/cassandra/saved_caches # directory deleted // after (bash) mkdir -p /var/lib/cassandra/saved_caches && chown cassandra:cassandra /var/lib/cassandra/saved_caches
Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight (bash)
DIR=$(grep saved_caches_directory /etc/cassandra/cassandra.yaml | awk '{print $2}')
test -d "$DIR" && test -w "$DIR" || { mkdir -p "$DIR"; chown cassandra:cassandra "$DIR"; } Prevention
- Verify saved_caches_directory exists and is writable after any path/cassandra.yaml change.
- Include directory creation and ownership in node provisioning/automation.
- Check mount health when the data volume is shared or remoted.
- After changing the service user, chown the whole Cassandra data tree.
When it happens
Trigger: The saved_caches directory does not exist, is unreadable by the Cassandra process, or an I/O error occurs while listing it during a cache save triggered by periodic auto-save or shutdown.
Common situations: saved_caches path deleted or misconfigured in cassandra.yaml; wrong ownership after changing the service user; read-only or unmounted filesystem; directory on a failed/unavailable volume.
Related errors
- %s exists but is not writable
- Failed to delete {}
- Unable check disk space in '%s'. Perhaps the Cassandra user
- ; unable to start server
- Unable to create directory " + dir
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/c189e7423523d3a9.
Report an issue: GitHub.