{"record":{"id":"3377cec0166957b7","repo":"apache/cassandra","slug":"unhandled-domain-domain","errorCode":null,"errorMessage":"Unhandled domain {domain}","messagePattern":"Unhandled domain (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/txn/TxnNamedRead.java","lineNumber":250,"sourceCode":"    {\n        ReadCommand command = deserialize(tables);\n        if (command == null)\n            return AsyncChains.success(new TxnData());\n\n        // It's fine for our nowInSeconds to lag slightly our insertion timestamp, as to the user\n        // this simply looks like the transaction witnessed TTL'd data and the data then expired\n        // immediately after the transaction executed, and this simplifies things a great deal\n        long nowInSeconds = nowInSeconds(executeAt);\n\n        boolean withoutReconciliation = readsWithoutReconciliation(consistencyLevel);\n        switch (key.domain())\n        {\n            case Key:\n                return performLocalKeyRead(executor, ((SinglePartitionReadCommand) command).withTransactionalSettings(withoutReconciliation, nowInSeconds));\n            case Range:\n                return performLocalRangeRead(executor, ((PartitionRangeReadCommand) command), key.asRange(), consistencyLevel, nowInSeconds);\n            default:\n                throw new IllegalStateException(\"Unhandled domain \" + key.domain());\n        }\n    }\n\n    public TxnNamedRead slice(Range range)\n    {\n        Invariants.require(key.domain().isRange());\n        if (key.equals(range))\n            return this;\n\n        Invariants.require(((Range)key).contains(range));\n        return new TxnNamedRead(txnDataName(), range, unsafeBytes());\n    }\n\n    public TxnNamedRead merge(TxnNamedRead with)\n    {\n        Invariants.require(key.domain().isRange());\n        if (key.equals(with.key))\n            return this;","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/txn/TxnNamedRead.java#L232-L268","documentation":"TxnNamedRead.read() dispatches a local read based on the Domain of the read's key. Accord transactions only support Domain.Key and Domain.Range reads; any other Domain value reaches the default branch, indicating an unhandled or newly added Domain that this code path does not implement.","triggerScenarios":"Calling TxnNamedRead.read() with a TxnNamedRead whose key domain is neither Key nor Range — typically after a new Domain enum constant is added to Accord or a corrupted/malformed serialized TxnNamedRead supplies an unexpected domain.","commonSituations":"Developers extending the Domain enum in the Accord integration without updating the read dispatch; deserializing transaction data from a newer/older Cassandra version with different Domain values; internal invariant breakage in transaction setup.","solutions":["Add a case for the missing Domain constant in the switch in TxnNamedRead.read()","Verify the TxnNamedRead was constructed/serialized with a supported domain (Key or Range)","Check for version skew between nodes — upgrade the cluster so all nodes agree on the Domain enum","Confirm the command passed in is a SinglePartitionReadCommand (Key) or PartitionRangeReadCommand (Range) as expected"],"exampleFix":"// before\ndefault:\n    throw new IllegalStateException(\"Unhandled domain \" + key.domain());\n// after\ncase RangeSlice:\n    return performLocalRangeSliceRead(executor, command, key.asRange(), consistencyLevel, nowInSeconds);\ndefault:\n    throw new IllegalStateException(\"Unhandled domain \" + key.domain());","handlingStrategy":"validation","validationCode":"if (!EnumSet.of(Domain.Key, Domain.Range).contains(namedRead.key().domain()))\n    throw new IllegalArgumentException(\"Read domain must be Key or Range: \" + namedRead.key().domain());","typeGuard":"static boolean hasSupportedDomain(TxnNamedRead read) {\n    Domain d = read.key().domain();\n    return d == Domain.Key || d == Domain.Range;\n}","tryCatchPattern":"try { read = namedRead.read(executor, ...); }\ncatch (IllegalStateException e) { /* unsupported domain — log domain and fail the txn */ }","preventionTips":["When adding a Domain constant, grep for switch statements over Domain and update all of them","Keep exhaustive switch dispatch (no shared default) so compilers flag missing cases","Test transaction reads for every Domain value in CI"],"tags":["accord","internal-invariant","domain-dispatch"],"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-17T15:17:12.973Z"}