{"record":{"id":"7287d7ec1570161a","repo":"apache/cassandra","slug":"unable-to-load-yaml-file-from-file","errorCode":null,"errorMessage":"Unable to load yaml file from: ${file}","messagePattern":"Unable to load yaml file from: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/StressProfile.java","lineNumber":865,"sourceCode":"                    return new Lists(name, getGenerator(name, collectionType, null, config), config);\n                default:\n                    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\");\n            }\n        }\n    }\n\n    public static StressProfile load(URI file) throws IOError\n    {\n        try\n        {\n            Constructor constructor = new Constructor(StressYaml.class, YamlConfigurationLoader.getDefaultLoaderOptions());\n\n            Yaml yaml = new Yaml(constructor);\n\n            InputStream yamlStream = file.toURL().openStream();\n\n            if (yamlStream.available() == 0)\n                throw new IOException(\"Unable to load yaml file from: \"+file);\n\n            StressYaml profileYaml = yaml.loadAs(yamlStream, StressYaml.class);\n\n\n            StressProfile profile = new StressProfile();\n            profile.init(profileYaml);\n\n            return profile;\n        }\n        catch (YAMLException | IOException | RequestValidationException e)\n        {\n            throw new IOError(e);\n        }\n    }\n\n    static <V> void lowerCase(Map<String, V> map)\n    {\n        List<Map.Entry<String, V>> reinsert = new ArrayList<>();","sourceCodeStart":847,"sourceCodeEnd":883,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/StressProfile.java#L847-L883","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the profile file path/URI exists and is readable (ls / curl the URL)","Ensure the YAML file is non-empty and contains a valid profile","Fix the -profile= argument on the stress command line","If using a URI/classpath resource, confirm it is deployed where the stress process runs"],"exampleFix":"# before\nstress write -profile=./prof.yaml\n# after (file exists at correct path)\nstress write -profile=/etc/cassandra/stress/profiles/prof.yaml","handlingStrategy":"validation","validationCode":"// verify profile file exists and is non-empty before load\njava.io.File f = new java.io.File(path);\nif (!f.isFile() || f.length() == 0) throw new java.io.IOException(\"profile missing or empty: \" + path);","typeGuard":"boolean profileReady(URI uri) { try (InputStream in = uri.toURL().openStream()) { return in != null && in.read() != -1; } catch (IOException e) { return false; } }","tryCatchPattern":"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; }","preventionTips":["Use absolute paths for -profile arguments","Confirm the file exists on every host running stress","Check file size > 0 before launching","For URI/classpath profiles, curl/openStream-test the URL first"],"tags":["yaml","file","cassandra-stress"],"backgroundTag":"file-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}