apache/cassandra · critical · ConfigurationException
Invalid yaml
Error message
Invalid yaml: <url>
What it means
YamlConfigurationLoader wraps any SnakeYAML exception raised while parsing/constructing the cassandra.yaml file into a ConfigurationException with this message. It means the YAML document at the given URL could not be parsed or mapped, and the original YAMLException is attached as the cause. Cassandra refuses to start with an unparsable config because configuration drives node behavior.
Solutions
- Open the cause of the ConfigurationException (getCause()) to find the exact YAML parse error and line number
- Validate the file with a YAML linter (e.g. python -c "import yaml,sys; yaml.safe_load(open('cassandra.yaml'))") before starting
- Fix indentation: use spaces only, never tabs, and keep consistent 2-4 space levels
- Ensure the URL points to a readable, complete cassandra.yaml
Example fix
// before (broken yaml) commitlog_sync: periodic commitlog_sync_period_in_ms: 10000 // after commitlog_sync: periodic commitlog_sync_period_in_ms: 10000
Defensive patterns
Strategy: try-catch
Validate before calling
import org.yaml.snakeyaml.Yaml;
try (var in = java.nio.file.Files.newInputStream(path)) {
new Yaml().load(in); // throws before Cassandra does
} Try / catch
try {
config = loader.loadConfig(url);
} catch (ConfigurationException e) {
log.error("Bad cassandra.yaml at " + url + ": " + e.getCause(), e);
throw e;
} Prevention
- Lint cassandra.yaml with a YAML parser in CI before shipping
- Never use tab characters in YAML; use spaces
- Keep cassandra.yaml under version control with a syntax check hook
- Diff your yaml against the shipped conf/cassandra.yaml template each upgrade
When it happens
Trigger: Calling YamlConfigurationLoader.loadConfig(URL) (directly or via the 'config' loader factory) when the file contains YAML syntax errors (bad indentation, tabs, unclosed quotes) or content that cannot be deserialized; also triggered when loadConfig(byte[]) conversion of the bytes to a document fails inside loadConfig's try block.
Common situations: Hand-edited cassandra.yaml with a tab character or wrong indentation; truncated config after a failed deployment or volume mount; storing secrets in YAML that breaks quoting; copy-pasting config from a web page losing spacing.
Related errors
- Can not initialize CMS without any seeds
- Cannot find configured row cache provider class
- Cannot locate . If this is a local file, please confirm…
- Cannot replace a live node...
- Cannot replace same address when accord transactions are…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/148dd828fed3dbfd.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/config/YamlConfigurationLoader.java:166
try
{
logger.debug("Loading settings from {}", url);
byte[] configBytes;
try (InputStream is = url.openStream())
{
configBytes = ByteStreams.toByteArray(is);
}
catch (IOException e)
{
// getStorageConfigURL should have ruled this out
throw new AssertionError(e);
}
return loadConfig(configBytes);
}
catch (YAMLException e)
{
throw new ConfigurationException("Invalid yaml: " + url, e);
}
}
@VisibleForTesting
static Config loadConfig(byte[] configBytes)
{
SafeConstructor constructor = new CustomConstructor(Config.class, Yaml.class.getClassLoader());
Map<Class<?>, Map<String, Replacement>> replacements = getNameReplacements(Config.class);
verifyReplacements(replacements, configBytes);
PropertiesChecker propertiesChecker = new PropertiesChecker(replacements);
constructor.setPropertyUtils(propertiesChecker);
Yaml yaml = new Yaml(constructor);
Config result = loadConfig(yaml, configBytes);
propertiesChecker.check();
maybeAddEnvironmentVariables(result);
maybeAddSystemProperties(result);
return result;
}View on GitHub (pinned to 88fd0f6a0e)