apache/cassandra · error · IOException

Failed to load Bloom filter for SSTable:

Error message

Failed to load Bloom filter for SSTable: 

What it means

FilterComponent.load reads an SSTable's filter component and deserializes its Bloom filter. If the read or deserialization throws IOException, it is rethrown with 'Failed to load Bloom filter for SSTable: <baseFile>' and the original cause attached, identifying which SSTable's Bloom filter could not be loaded.

Source

Thrown at src/java/org/apache/cassandra/io/sstable/format/FilterComponent.java:69

     * Load bloom filter from Filter.db file.
     */
    public static IFilter load(Descriptor descriptor) throws IOException
    {
        File filterFile = descriptor.fileFor(Components.FILTER);

        if (!filterFile.exists())
            return null;

        if (filterFile.length() == 0)
            return FilterFactory.AlwaysPresent;

        try (FileInputStreamPlus stream = descriptor.fileFor(Components.FILTER).newInputStream())
        {
            return BloomFilterSerializer.forVersion(descriptor.version.hasOldBfFormat()).deserialize(stream);
        }
        catch (IOException ex)
        {
            throw new IOException("Failed to load Bloom filter for SSTable: " + descriptor.baseFile(), ex);
        }
    }

    public static void save(IFilter filter, Descriptor descriptor, boolean deleteOnFailure) throws IOException
    {
        File filterFile = descriptor.fileFor(Components.FILTER);
        try (FileOutputStreamPlus stream = filterFile.newOutputStream(File.WriteMode.OVERWRITE))
        {
            filter.serialize(stream, descriptor.version.hasOldBfFormat());
            stream.flush();
            stream.sync();
        }
        catch (IOException ex)
        {
            if (deleteOnFailure)
                descriptor.fileFor(Components.FILTER).deleteIfExists();
            throw new IOException("Failed to save Bloom filter for SSTable: " + descriptor.baseFile(), ex);
        }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Restore Filter.db from a snapshot/backup, or delete the corrupt filter component so the SSTable can rebuild/use a dummy filter, then run scrub
  2. Run sstablescrub / nodetool scrub on the table to regenerate or quarantine the bad filter component
  3. Confirm the SSTable came from a compatible Cassandra version (Bloom filter format changed historically); recompact or re-stream from replicas if not
  4. Check disk health and permissions on the SSTable directory
Defensive patterns

Strategy: try-catch

Validate before calling

File filterFile = descriptor.fileFor(Component.FILTER);
if (!filterFile.exists() || filterFile.length() == 0)
    throw new IOException("Filter component missing/empty for " + descriptor);

Try / catch

try { filter = FilterComponent.load(descriptor); }
catch (IOException e) {
    logger.warn("Bloom filter unusable for {}: {}", descriptor.baseFile(), e.getMessage());
    // fall back to a dummy filter (all probes positive) and scrub the SSTable
    filter = BloomFilterFactory.alwaysPresentingFilter();
}

Prevention

When it happens

Trigger: Opening an SSTable whose Filter.db file is unreadable: missing/truncated filter file, corrupt Bloom filter bytes (checksum mismatch), wrong bf format for the descriptor version, or I/O error on the underlying stream.

Common situations: Filter.db lost during incomplete restores; disk corruption; mixing SSTables between Cassandra versions with different Bloom filter formats (hasOldBfFormat mismatch); out-of-space reads.

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


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