{"record":{"id":"a11c2acc451c98dd","repo":"apache/cassandra","slug":"step-s-is-invalid-for-sequence-s","errorCode":null,"errorMessage":"Step %s is invalid for sequence %s ","messagePattern":"Step (.+?) is invalid for sequence (.+?) ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tcm/sequences/BootstrapAndJoin.java","lineNumber":477,"sourceCode":"                });\n            }\n            movementMapBuilder.put(params, movements.build());\n        });\n        return movementMapBuilder.build();\n    }\n\n    private static int nextToIndex(Transformation.Kind next)\n    {\n        switch (next)\n        {\n            case START_JOIN:\n                return 0;\n            case MID_JOIN:\n                return 1;\n            case FINISH_JOIN:\n                return 2;\n            default:\n                throw new IllegalStateException(String.format(\"Step %s is invalid for sequence %s \", next, JOIN));\n        }\n    }\n\n    private static Transformation.Kind indexToNext(int index)\n    {\n        switch (index)\n        {\n            case 0:\n                return START_JOIN;\n            case 1:\n                return MID_JOIN;\n            case 2:\n                return FINISH_JOIN;\n            default:\n                throw new IllegalStateException(String.format(\"Step %s is invalid for sequence %s \", index, JOIN));\n        }\n    }\n","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/sequences/BootstrapAndJoin.java#L459-L495","documentation":"BootstrapAndJoin.nextToIndex maps the sequence's current Transformation.Kind to its ordinal index (START_JOIN=0, MID_JOIN=1, FINISH_JOIN=2). It throws IllegalStateException for any other kind, since that kind cannot belong to a BootstrapAndJoin sequence.","triggerScenarios":"Constructing or advancing a BootstrapAndJoin sequence whose current step (next) is a Transformation.Kind from another sequence type (e.g. REPLACE kinds) or an uninitialized value.","commonSituations":"Metadata deserialization or replay produced a step kind inconsistent with this sequence class; a coding error constructs BootstrapAndJoin with a REPLACE-state kind; metadata corruption after a partial transform application.","solutions":["Verify the Transformation.Kind stored in metadata for this node actually belongs to the JOIN sequence family","Replay or re-fetch cluster metadata to recover a consistent transformation log","If this occurs during deserialization of a plan, check for version skew between nodes running different transformation kinds and upgrade consistently","Fix construction sites so BootstrapAndJoin is only created with START_JOIN/MID_JOIN/FINISH_JOIN kinds"],"exampleFix":"// before\nBootstrapAndJoin seq = new BootstrapAndJoin(nodeId, anyKind, ...);\n// after\nif (kind != Transformation.Kind.START_JOIN && kind != MID_JOIN && kind != FINISH_JOIN)\n    throw new IllegalArgumentException(\"kind not part of BootstrapAndJoin: \" + kind);\nBootstrapAndJoin seq = new BootstrapAndJoin(nodeId, kind, ...);","handlingStrategy":"validation","validationCode":"Set<Transformation.Kind> joinKinds = Set.of(START_JOIN, MID_JOIN, FINISH_JOIN);\nif (!joinKinds.contains(kind)) throw new IllegalArgumentException(\"not a join kind: \" + kind);","typeGuard":null,"tryCatchPattern":"try { BootstrapAndJoin seq = reconstruct(state); } catch (IllegalStateException e) { /* re-read metadata / flag transformation-log corruption */ }","preventionTips":["Only construct BootstrapAndJoin from kinds in its own family","Validate transformation logs during deserialization/replay","Keep node software versions consistent across the cluster"],"tags":["tcm","bootstrap","state-machine","sequence","illegal-state"],"backgroundTag":"invalid-enum-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"}