apache/cassandra · error · RuntimeException

Couldn't load existing stats html.

Error message

Couldn't load existing stats html.

What it means

StressGraph.generateGraph wraps any IOException from reading the previously generated HTML report into a RuntimeException with the message 'Couldn't load existing stats html.' This happens only when graphing with an existing html file whose bytes cannot be read from disk. The original IOException is swallowed, so the real cause (missing file, permissions, path issues) is not reported.

Solutions

  1. Verify the path of the existing graph HTML exists and is readable (ls / cat the file) before rerunning.
  2. Regenerate the report from scratch by running stress graphing without the existing-html input.
  3. Fix filesystem permissions or mount the directory containing the previous report.
  4. Patch the catch to include the file path and cause: new RuntimeException("Couldn't load existing stats html: " + htmlFile, e).

Example fix

// before
catch (IOException e)
{
    throw new RuntimeException("Couldn't load existing stats html.");
}
// after
catch (IOException e)
{
    throw new RuntimeException("Couldn't load existing stats html: " + htmlFile, e);
}
Defensive patterns

Strategy: validation

Validate before calling

java.io.File f = htmlFile; if (f == null || !f.isFile() || !f.canRead()) throw new IllegalArgumentException("Existing graph html not readable: " + f);

Try / catch

try { generateGraph(); } catch (RuntimeException e) { if (e.getMessage().contains("Couldn't load existing stats html")) { System.err.println("Falling back to fresh graph generation"); generateFreshGraph(); } else throw e; }

Prevention

When it happens

Trigger: Running cassandra-stress graph generation pointing at an existing htmlFile path that does not exist, is a directory, or is unreadable, so Files.readAllBytes in the load-existing-stats branch throws IOException.

Common situations: Typo in the graph file path; report file deleted or moved between runs; running in a container where the prior report volume is not mounted; read-permission problems.

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/eb94edadc67162db. Report an issue: GitHub.

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/StressGraph.java:77

    {
        this.stressSettings = stressSetttings;
        this.stressArguments = stressArguments;
    }

    public void generateGraph()
    {
        File htmlFile = new File(stressSettings.graph.file);
        ObjectNode stats;
        if (htmlFile.isFile())
        {
            try
            {
                String html = new String(Files.readAllBytes(Paths.get(htmlFile.toURI())), StandardCharsets.UTF_8);
                stats = parseExistingStats(html);
            }
            catch (IOException e)
            {
                throw new RuntimeException("Couldn't load existing stats html.");
            }
            stats = this.createJSONStats(stats);
        }
        else
        {
            stats = this.createJSONStats(null);
        }

        try
        {
            PrintWriter out = new PrintWriter(htmlFile);
            String statsBlock = "/* stats start */\nstats = " + JsonUtils.writeAsJsonString(stats) + ";\n/* stats end */\n";
            String html = getGraphHTML().replaceFirst("/\\* stats start \\*/\n\n/\\* stats end \\*/\n", statsBlock);
            out.write(html);
            out.close();
        }
        catch (IOException e)
        {

View on GitHub (pinned to 88fd0f6a0e)