apache/cassandra · error · IOException

Unable to load yaml file from

Error message

Unable to load yaml file from: ${file}

What it means

StressProfile.load opens the profile YAML from a URI and validates it is non-empty before parsing; if the stream reports zero available bytes, an IOException 'Unable to load yaml file from: <file>' is thrown. This surfaces missing or empty profile files at load time.

Solutions

  1. Verify the profile file path/URI exists and is readable (ls / curl the URL)
  2. Ensure the YAML file is non-empty and contains a valid profile
  3. Fix the -profile= argument on the stress command line
  4. If using a URI/classpath resource, confirm it is deployed where the stress process runs

Example fix

# before
stress write -profile=./prof.yaml
# after (file exists at correct path)
stress write -profile=/etc/cassandra/stress/profiles/prof.yaml
Defensive patterns

Strategy: validation

Validate before calling

// verify profile file exists and is non-empty before load
java.io.File f = new java.io.File(path);
if (!f.isFile() || f.length() == 0) throw new java.io.IOException("profile missing or empty: " + path);

Type guard

boolean profileReady(URI uri) { try (InputStream in = uri.toURL().openStream()) { return in != null && in.read() != -1; } catch (IOException e) { return false; } }

Try / catch

try { StressProfile.load(uri); } catch (IOException e) { if (e.getMessage().startsWith("Unable to load yaml file")) log.error("Check -profile path/URI: {}", uri); throw e; }

Prevention

When it happens

Trigger: load(URI file) where the URL points to a nonexistent resource, an empty file, or a stream that reports 0 bytes available (e.g. wrong path, missing file on classpath, unreadable remote URI).

Common situations: Typos in the profile file path passed with -profile, file not copied to nodes, empty placeholder file, URL pointing at a missing HTTP/classpath resource.

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

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/StressProfile.java:865

                    return new Lists(name, getGenerator(name, collectionType, null, config), config);
                default:
                    throw new UnsupportedOperationException("Because of this name: "+name+" if you removed it from the yaml and are still seeing this, make sure to drop table");
            }
        }
    }

    public static StressProfile load(URI file) throws IOError
    {
        try
        {
            Constructor constructor = new Constructor(StressYaml.class, YamlConfigurationLoader.getDefaultLoaderOptions());

            Yaml yaml = new Yaml(constructor);

            InputStream yamlStream = file.toURL().openStream();

            if (yamlStream.available() == 0)
                throw new IOException("Unable to load yaml file from: "+file);

            StressYaml profileYaml = yaml.loadAs(yamlStream, StressYaml.class);


            StressProfile profile = new StressProfile();
            profile.init(profileYaml);

            return profile;
        }
        catch (YAMLException | IOException | RequestValidationException e)
        {
            throw new IOError(e);
        }
    }

    static <V> void lowerCase(Map<String, V> map)
    {
        List<Map.Entry<String, V>> reinsert = new ArrayList<>();

View on GitHub (pinned to 88fd0f6a0e)