{"record":{"id":"e4e46d36f4b4f8b6","repo":"apache/cassandra","slug":"schema-can-only-be-provided-with-predefined-opera","errorCode":null,"errorMessage":"-schema can only be provided with predefined operations insert, read, etc.; the 'user' command requires a schema yaml instead","messagePattern":"-schema can only be provided with predefined operations insert, read, etc\\.; the 'user' command requires a schema yaml instead","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/SettingsSchema.java","lineNumber":243,"sourceCode":"    {\n        out.println(\"  Keyspace: \" + keyspace);\n        out.println(\"  Replication Strategy: \" + replicationStrategy);\n        out.println(\"  Replication Strategy Options: \" + replicationStrategyOptions);\n\n        out.println(\"  Table Compression: \" + compression);\n        out.println(\"  Table Compaction Strategy: \" + compactionStrategy);\n        out.println(\"  Table Compaction Strategy Options: \" + compactionStrategyOptions);\n    }\n\n\n    public static SettingsSchema get(Map<String, String[]> clArgs, SettingsCommand command)\n    {\n        String[] params = clArgs.remove(\"-schema\");\n        if (params == null)\n            return new SettingsSchema(new Options(), command);\n\n        if (command instanceof SettingsCommandUser)\n            throw new IllegalArgumentException(\"-schema can only be provided with predefined operations insert, read, etc.; the 'user' command requires a schema yaml instead\");\n\n        GroupedOptions options = GroupedOptions.select(params, new Options());\n        if (options == null)\n        {\n            printHelp();\n            System.out.println(\"Invalid -schema options provided, see output for valid options\");\n            System.exit(1);\n        }\n        return new SettingsSchema((Options) options, command);\n    }\n\n    public static void printHelp()\n    {\n        GroupedOptions.printOptions(System.out, \"-schema\", new Options());\n    }\n\n    public static Runnable helpPrinter()\n    {","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/SettingsSchema.java#L225-L261","documentation":"The 'user' command defines its schema in a profile YAML, so a -schema option on the command line is contradictory. SettingsSchema.get throws IllegalArgumentException whenever -schema appears together with a user command.","triggerScenarios":"cassandra-stress user profile=profile.yaml -schema replication(...)... — supplying -schema to the user command in any form.","commonSituations":"Adapting an insert/read command line to a user profile and leaving the old -schema fragment in place; copied CI scripts.","solutions":["Remove the -schema option and define keyspace/table/replication inside the profile YAML instead","Set the keyspace in the profile's keyspace spec, or pass only non-schema options like -rate, -log","If you need -schema, switch to a predefined command (insert, read, mixed, counter_write, etc.)"],"exampleFix":"// before\ncassandra-stress user profile=prof.yaml -schema replication(factor=3)\n// after\ncassandra-stress user profile=prof.yaml ops(insert=1)  # keyspace defined in prof.yaml","handlingStrategy":"validation","validationCode":"boolean isUser = args.get(0).equals(\"user\");\nif (isUser && Arrays.asList(args).contains(\"-schema\"))\n    throw new IllegalArgumentException(\"drop -schema; define keyspace/table in the profile yaml\");","typeGuard":null,"tryCatchPattern":"try { StressSettings.get(parseMap(args)); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"-schema can only be provided with predefined\")) args = removeOption(args, \"-schema\"); else throw e; }","preventionTips":["Keep profile.yaml as the single source of schema truth for user commands","Sanitize copied command lines: strip -schema when switching to 'user'","Define keyspace and column families inside the profile's keyspace/table specs"],"tags":["cli","config","schema"],"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"}