apache/cassandra · critical · ConfigurationException

Unable to read reserved keywords file '%s'

Error message

Unable to read reserved keywords file '%s'

What it means

At class initialization ReservedKeywords loads its list of reserved CQL words from a resource file bundled in the Cassandra jar. If reading that resource throws IOException, it aborts startup/configuration with ConfigurationException. This is an internal resource-loading failure, not a user query problem.

Source

Thrown at src/java/org/apache/cassandra/cql3/ReservedKeywords.java:56

    @VisibleForTesting
    static final Set<String> reservedKeywords = getFromResource();

    private static Set<String> getFromResource()
    {
        ImmutableSet.Builder<String> builder = ImmutableSet.builder();
        try (InputStream is = ReservedKeywords.class.getResource(FILE_NAME).openConnection().getInputStream();
             BufferedReader r = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)))
        {
            String line;
            while ((line = r.readLine()) != null)
            {
                builder.add(line.trim());
            }
        }
        catch (IOException e)
        {
            throw new ConfigurationException(String.format("Unable to read reserved keywords file '%s'", FILE_NAME), e);
        }
        return builder.build();
    }

    public static boolean isReserved(String text)
    {
        return reservedKeywords.contains(toUpperCaseLocalized(text));
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Restore the complete official Cassandra jar (the resource file must be inside it)
  2. If building a fat/shaded jar, include resources from the Cassandra jar (don't filter/exclude .txt resources)
  3. Verify with `unzip -l cassandra-all.jar | grep reservedkeywords` that the file exists
  4. Re-download/redeploy the installation if files are corrupted
Defensive patterns

Strategy: try-catch

Validate before calling

try (InputStream in = getClass().getResourceAsStream(FILE_NAME)) {
    if (in == null) throw new IllegalStateException("reserved keywords resource missing from jar");
}

Try / catch

try { ReservedKeywords.isReserved(word); } catch (ThrowableInInitializerError | NoClassDefFoundError e) { verifyJarIntegrity(); throw e; }

Prevention

When it happens

Trigger: Class initialization of ReservedKeywords when the resource file (org/apache/cassandra/cql3/reservedkeywords.txt) is missing from the classpath or unreadable — e.g. corrupted/incomplete jar, shaded jar that excluded resources, custom classloader issues.

Common situations: Manually assembled classpaths missing resource files; repackaged/truncated cassandra jar; embedded usage where a build plugin stripped non-class resources; running from a damaged installation.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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