{"record":{"id":"e1fdcd77b9786878","repo":"apache/cassandra","slug":"must-only-specify-a-singe-yaml-file-per-table-inc","errorCode":null,"errorMessage":"Must only specify a singe YAML file per table (including keyspace qualifier).","messagePattern":"Must only specify a singe YAML file per table \\(including keyspace qualifier\\)\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java","lineNumber":90,"sourceCode":"        for (String curYamlPath : yamlPaths)\n        {\n            File yamlFile = new File(curYamlPath);\n            URI yamlURI;\n            if (yamlFile.exists()) {\n            \tyamlURI = yamlFile.toURI();\n            } else {\n            \tyamlURI = URI.create(curYamlPath);\n            \tString uriScheme = yamlURI.getScheme();\n            \tif (uriScheme == null || \"file\".equals(uriScheme)) {\n                    throw new IllegalArgumentException(\"File '\" + yamlURI.getPath() + \"' doesn't exist!\");\n            \t}\n            }\n            StressProfile profile = StressProfile.load(yamlURI);\n            String specName = profile.specName;\n            if (default_profile_name == null) {default_profile_name=specName;} //first file is default\n            if (profiles.containsKey(specName))\n            {\n                throw new IllegalArgumentException(\"Must only specify a singe YAML file per table (including keyspace qualifier).\");\n            }\n            profiles.put(specName, profile);\n        }\n\n\n        if (ratios.size() == 0)\n            throw new IllegalArgumentException(\"Must specify at least one command with a non-zero ratio\");\n    }\n\n    public boolean hasInsertOnly()\n    {\n        return ratios.size() == 1 && ratios.containsKey(\"insert\");\n    }\n\n    public OpDistributionFactory getFactory(final StressSettings settings)\n    {\n        final SeedManager seeds = new SeedManager(settings);\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java#L72-L108","documentation":"For the 'user' command, each YAML profile declares a specName (keys.table). Profiles are stored in a map keyed by specName, so declaring two YAML files for the same table would collide; the constructor throws this IllegalArgumentException to reject the duplicate definition.","triggerScenarios":"Running 'cassandra-stress user profile=a.yaml profile=b.yaml ops(...)' where both YAML files declare the same keyspace/table combination in their specName, so profiles.containsKey(specName) is true when the second file is loaded.","commonSituations":"Copying a profile YAML and editing operations but forgetting to change the table name; pointing two profile flags at different files that describe the same table; a generated config loop emitting the same table twice with different op weights.","solutions":["Change the keyspace/table in one of the YAML files so each profile targets a distinct table.","Remove the duplicate profile=<file> argument if both files were meant to be the same profile.","Check the 'specName'/table declaration at the top of each YAML file and make them unique.","Merge the intended operations into a single profile YAML instead of splitting across files."],"exampleFix":"// before: both profile1.yaml and profile2.yaml declare keyspace: ks1, table: t1\n// after: edit profile2.yaml\ntable: t2","handlingStrategy":"validation","validationCode":"Set<String> tables = new HashSet<>();\nfor (String yaml : yamlFiles) { String spec = readSpecName(yaml); if (!tables.add(spec)) throw new IllegalArgumentException(\"duplicate table profile: \" + spec); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When copying profile YAMLs, update the keyspace/table header too.","Uniquely name each profile's keyspace.table before combining them in one command.","Merge op weights for the same table into one YAML."],"tags":["cli","configuration","duplicate"],"backgroundTag":"conflicting-config-options","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"}