{"record":{"id":"0a75cda3ea865be2","repo":"apache/cassandra","slug":"pull-repair-can-only-be-performed-between-two-host","errorCode":null,"errorMessage":"Pull repair can only be performed between two hosts. Please specify two hosts, one of which must be this host.","messagePattern":"Pull repair can only be performed between two hosts\\. Please specify two hosts, one of which must be this host\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/repair/messages/RepairOption.java","lineNumber":297,"sourceCode":"\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.\");\n            }\n        }\n\n        return option;\n    }\n\n    private final RepairParallelism parallelism;\n    private final boolean primaryRange;\n    private final boolean incremental;\n    private final boolean trace;\n    private final int jobThreads;\n    private final boolean pullRepair;\n    private final boolean forceRepair;\n    private final PreviewKind previewKind;","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/repair/messages/RepairOption.java#L279-L315","documentation":"Pull repair (incremental streaming one direction only) is defined strictly between two hosts. RepairOption.parse throws IllegalArgumentException unless exactly two hosts were supplied — fewer or more than two makes the pull semantics undefined.","triggerScenarios":"nodetool repair --pull ... with a host list whose size != 2 (0, 1, or 3+ hosts).","commonSituations":"Operators reusing a generic repair command with many -hosts entries and adding --pull; forgetting that pull repair requires exactly the two endpoints.","solutions":["Pass exactly two hosts with -hosts, one of which must be the local node","Remove --pull if you actually want a normal multi-host repair","Split larger topologies into pairwise pull repairs"],"exampleFix":"// before\nnodetool repair --pull -hosts 10.0.0.1,10.0.0.2,10.0.0.3 keyspace1\n// after\nnodetool repair --pull -hosts 10.0.0.1,10.0.0.2 keyspace1","handlingStrategy":"validation","validationCode":"if (pullRepair && (hosts == null || hosts.size() != 2))\n    throw new IllegalArgumentException(\"pull repair requires exactly two hosts\");","typeGuard":null,"tryCatchPattern":"try { RepairOption.parse(opts); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Pull repair can only be performed between two hosts\")) { /* fix host list */ } else throw e; }","preventionTips":["Build pull-repair commands from explicit endpoint pairs","Do not reuse generic repair invocations for --pull","Assert the local node is one of the two hosts before submitting"],"tags":["repair","cli","argument-count"],"backgroundTag":"invalid-argument-value","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"}