apache/cassandra · warning

Failed to dump trie to

Error message

Failed to dump trie to {} due to exception

What it means

PartitionIndex.dumpTrie(fileName) writes a human-readable dump of the BTI partition index trie to a file, mainly for debugging support tickets. Any exception during the dump (unwritable path, I/O error, corruption while reading the trie) is swallowed with this WARN log — it never affects normal operation since dumping is a diagnostic side feature.

Solutions

  1. Check the logged exception to see whether it's a file-write problem or an index-read problem.
  2. Verify the output directory is writable and has free space; retry the dump to a different path (e.g. /tmp).
  3. If the trie itself fails to read, run `nodetool scrub`/compact on the sstable first, then retry the dump.
  4. If only diagnostics failed, no data-path action is needed — the sstable keeps serving normally.

Example fix

// before: dumpTrie('/read-only-dir/index.dump') fails silently
// after: choose a writable destination
PartitionIndex idx = ...;
idx.dumpTrie("/tmp/bti-index-dump.txt"); // writable location
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure destination is writable before dumping
File f = new File(fileName);
if (!f.getParentFile().canWrite()) throw new IllegalStateException("Cannot write trie dump to " + fileName);

Try / catch

// dumpTrie already swallows exceptions; treat WARN as non-fatal
partitionIndex.dumpTrie("/tmp/index-dump.txt");
// verify output exists if the dump is required
if (!new File("/tmp/index-dump.txt").exists()) logger.warn("Trie dump not produced");

Prevention

When it happens

Trigger: Calling PartitionIndex.dumpTrie(path) (used by debugging tooling / support diagnostics on a BTI sstable's Index.db) when the target path is unwritable, the disk is full, or reading the trie via openReader() fails.

Common situations: Engineers dumping index tries for Cassandra support; read-only filesystem or wrong permissions on the output path; dumping an index from a corrupt or partially-open sstable.

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


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

Appendix: source

Thrown at src/java/org/apache/cassandra/io/sstable/format/bti/PartitionIndex.java:443

            pos = INVALID; // make sure next time we call nextPayloadedNode() again
            return getIndexPos(buf, payloadPosition(), payloadFlags()); // this should not throw
        }
    }

    /**
     * debug/test code
     */
    @VisibleForTesting
    public void dumpTrie(String fileName)
    {
        try(PrintStream ps = new PrintStream(fileName))
        {
            dumpTrie(ps);
        }
        catch (Throwable t)
        {
            logger.warn("Failed to dump trie to {} due to exception", fileName, t);
        }
    }

    private void dumpTrie(PrintStream out) throws IOException
    {
        try (Reader rdr = openReader())
        {
            rdr.dumpTrie(out, (buf, ppos, pbits, version) -> Long.toString(getIndexPos(buf, ppos, pbits)), null);
        }
    }

}

View on GitHub (pinned to 88fd0f6a0e)