{"record":{"id":"a40dc629898fe18d","repo":"apache/cassandra","slug":"too-many-job-threads-max-is-s","errorCode":null,"errorMessage":"Too many job threads. Max is %s","messagePattern":"Too many job threads\\. Max is (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/repair/messages/RepairOption.java","lineNumber":283,"sourceCode":"        }\n\n        // columnfamilies\n        String cfStr = options.get(COLUMNFAMILIES_KEY);\n        if (cfStr != null)\n        {\n            Collection<String> columnFamilies = new HashSet<>();\n            StringTokenizer tokenizer = new StringTokenizer(cfStr, \",\");\n            while (tokenizer.hasMoreTokens())\n            {\n                columnFamilies.add(tokenizer.nextToken().trim());\n            }\n            option.getColumnFamilies().addAll(columnFamilies);\n        }\n\n        // validate options\n        if (jobThreads > MAX_JOB_THREADS)\n        {\n            throw new IllegalArgumentException(\"Too many job threads. Max is \" + MAX_JOB_THREADS);\n        }\n        if (!dataCenters.isEmpty() && !hosts.isEmpty())\n        {\n            throw new IllegalArgumentException(\"Cannot combine -dc and -hosts options.\");\n        }\n        if (primaryRange && ((!dataCenters.isEmpty() && !option.isInLocalDCOnly()) || !hosts.isEmpty()))\n        {\n            throw new IllegalArgumentException(\"You need to run primary range repair on all nodes in the cluster.\");\n        }\n        if (pullRepair)\n        {\n            if (hosts.size() != 2)\n            {\n                throw new IllegalArgumentException(\"Pull repair can only be performed between two hosts. Please specify two hosts, one of which must be this host.\");\n            }\n            else if (ranges.isEmpty())\n            {\n                throw new IllegalArgumentException(\"Token ranges must be specified when performing pull repair. Please specify at least one token range which both hosts have in common.\");","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/repair/messages/RepairOption.java#L265-L301","documentation":"RepairOption.parse validates repair options supplied via nodetool/JMX and refuses a repair request whose parallelism (job threads) exceeds the configured maximum, MAX_JOB_THREADS. IllegalArgumentException is thrown because the request itself is malformed — more parallel repair jobs were requested than Cassandra will ever run. It fails fast before any repair session is created.","triggerScenarios":"Calling nodetool repair --job-threads N (or invoking RepairOption.parse programmatically) with N greater than MAX_JOB_THREADS.","commonSituations":"Operators copying job-thread counts from other clusters or docs, assuming higher parallelism speeds repair; scripts parameterizing job-threads without clamping to the max; version drift where the caller assumes an older, larger limit.","solutions":["Lower --job-threads to a value <= MAX_JOB_THREADS (check the constant in RepairOption.java for your version)","Remove the --job-threads flag entirely to use the default parallelism","Clamp the value in your automation before invoking repair"],"exampleFix":"// before\nnodetool repair --job-threads 64 keyspace1\n// after\nnodetool repair --job-threads 4 keyspace1","handlingStrategy":"validation","validationCode":"int jobThreads = Integer.parseInt(opts.getOrDefault(\"jobThreads\", \"1\"));\nif (jobThreads > MAX_JOB_THREADS) throw new IllegalArgumentException(\"jobThreads must be <= \" + MAX_JOB_THREADS);","typeGuard":null,"tryCatchPattern":"try { RepairOption.parse(opts); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Too many job threads\")) { /* clamp jobThreads and retry */ } else throw e; }","preventionTips":["Cap job-threads in wrapper scripts to the version's MAX_JOB_THREADS constant","Prefer the default parallelism unless profiling shows a need for more","Pin scripts to the cluster's Cassandra version"],"tags":["repair","cli","argument-out-of-range"],"backgroundTag":"value-out-of-range","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}