{"record":{"id":"15b77f30cd2168a9","repo":"apache/cassandra","slug":"the-tokens-provided-tokens-do-not-match-with-i","errorCode":null,"errorMessage":"The tokens provided ${tokens} do not match with  in progress BootstrapAndJoin sequence tokens ${sequenceTokens}. Cannot proceed further.","messagePattern":"The tokens provided (.+?) do not match with  in progress BootstrapAndJoin sequence tokens (.+?)\\. Cannot proceed further\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/CMSOfflineTool.java","lineNumber":677,"sourceCode":"            {\n                MultiStepOperation<?> multiStepOperation = metadata.inProgressSequences.get(nodeId);\n                if (multiStepOperation.kind() != MultiStepOperation.Kind.JOIN)\n                {\n                    throw new IllegalArgumentException(\"Another sequence of kind \" + multiStepOperation.kind() +\n                                                       \" is in progress for node \" + nodeIdentifierOption.getNodeIpOrId() +\n                                                       \". Cannot proceed with force join.\");\n                }\n                BootstrapAndJoin bootstrapAndJoin = (BootstrapAndJoin) multiStepOperation;\n                Set<Token> sequenceTokens = bootstrapAndJoin.finishJoin.tokens;\n                if (tokens.isEmpty()\n                    || (tokenSet.size() == sequenceTokens.size() && sequenceTokens.containsAll(tokenSet)))\n                {\n                    updatedMetadata = bootstrapAndJoin.applyTo(metadata).success().metadata;\n                }\n                else\n                {\n                    // If tokens are provided, then it should match with the in-progress sequence tokens\n                    throw new IllegalArgumentException(\"The tokens provided \" + tokens + \" do not match with \" +\n                                                       \" in progress BootstrapAndJoin sequence tokens \" +\n                                                       sequenceTokens + \". Cannot proceed further.\");\n                }\n            }\n            else\n            {\n                // There are no in-progress sequences, force join by using UnsafeJoin transformation\n                if (tokenSet.isEmpty())\n                {\n                    throw new IllegalArgumentException(\"Tokens must be provided to force join a node.\");\n                }\n                UnsafeJoin unsafeJoin = new UnsafeJoin(nodeId, tokenSet, new UniformRangePlacement());\n                updatedMetadata = unsafeJoin.execute(metadata).success().metadata;\n            }\n\n            writeMetadata(output, updatedMetadata, outputFilePath);\n        }\n    }","sourceCodeStart":659,"sourceCodeEnd":695,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/CMSOfflineTool.java#L659-L695","documentation":"Thrown by ForceJoin when tokens are explicitly provided but do not equal the tokens recorded in the node's in-progress BootstrapAndJoin sequence (bootstrapAndJoin.finishJoin.tokens). The force join must finish the existing sequence with its own tokens, so mismatched user-supplied tokens are rejected.","triggerScenarios":"Passing --tokens to force join while the node has an in-progress BootstrapAndJoin whose token list differs from the provided set (different count, values, or order-insensitive mismatch).","commonSituations":"Operator guesses or recomputes tokens instead of reading the pending sequence's tokens; copying tokens from another node; re-running the command with tokens from an older attempt after the ring changed.","solutions":["Omit --tokens so the tool accepts the in-progress sequence's tokens (the empty-tokens path applies the sequence).","Read the exact tokens from the in-progress BootstrapAndJoin sequence and pass them verbatim.","Re-check the metadata snapshot; regenerate tokens only if no sequence is in progress."],"exampleFix":"// before\n// forceJoin --id 3 --tokens 100,200   (sequence has [100,200,300])\n// after\n// forceJoin --id 3                    (no tokens; finishes the pending sequence)","handlingStrategy":"validation","validationCode":"Set<Token> sequenceTokens = ((BootstrapAndJoin) metadata.inProgressSequences.get(nodeId)).finishJoin.tokens;\nif (!tokens.isEmpty() && !sequenceTokens.equals(tokenSet))\n    throw new IllegalArgumentException(\"Tokens must match the in-progress sequence or be omitted\");","typeGuard":null,"tryCatchPattern":"try { forceJoin(...); } catch (IllegalArgumentException e) { logger.error(\"Token mismatch: \" + e.getMessage()); }","preventionTips":["Omit --tokens when a join sequence is in progress","Copy tokens exactly from the pending sequence","Never guess or recompute tokens for a pending sequence"],"tags":["cluster-metadata","tokens","mismatch"],"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"}