{"record":{"id":"200423806dc9a706","repo":"apache/cassandra","slug":"unexpected-error","errorCode":null,"errorMessage":"Unexpected error","messagePattern":"Unexpected error","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/transport/SimpleClient.java","lineNumber":518,"sourceCode":"            FrameDecoder frameDecoder = frameDecoder(ctx, allocator);\n            FrameEncoder frameEncoder = frameEncoder(ctx);\n            FrameEncoder.PayloadAllocator payloadAllocator = frameEncoder.allocator();\n\n            CQLMessageHandler.MessageConsumer<Message.Response> responseConsumer = new CQLMessageHandler.MessageConsumer<Message.Response>()\n            {\n                public <P> void dispatch(Channel channel, Message.Response message, Dispatcher.FlushItemConverter<P> toFlushItem, P param, Overload backpressure)\n                {\n                    responseHandler.handleResponse(channel, message);\n                }\n\n                public boolean hasQueueCapacity()\n                {\n                    return true;\n                }\n            };\n\n            CQLMessageHandler.ErrorHandler errorHandler = (error) -> {\n                throw new RuntimeException(\"Unexpected error\", error);\n            };\n\n            ClientResourceLimits.ResourceProvider resources = new ClientResourceLimits.ResourceProvider()\n            {\n                final ResourceLimits.Limit endpointReserve = new ResourceLimits.Basic(1024 * 1024 * 64);\n                final AbstractMessageHandler.WaitQueue endpointQueue = AbstractMessageHandler.WaitQueue.endpoint(endpointReserve);\n\n                final ResourceLimits.Limit globalReserve = new ResourceLimits.Basic(1024 * 1024 * 64);\n                final AbstractMessageHandler.WaitQueue globalQueue = AbstractMessageHandler.WaitQueue.global(endpointReserve);\n\n                public ResourceLimits.Limit globalLimit()\n                {\n                    return globalReserve;\n                }\n\n                public AbstractMessageHandler.WaitQueue globalWaitQueue()\n                {\n                    return globalQueue;","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/transport/SimpleClient.java#L500-L536","documentation":"The modern-pipeline CQLMessageHandler's ErrorHandler unconditionally rethrows any dispatch/processing error as RuntimeException(\"Unexpected error\", cause). It is a fail-fast guard: the simple test client has no strategy for frame-level processing errors, so any handler failure surfaces as this exception.","triggerScenarios":"Any exception inside the modern (v5+) message handler path — e.g. failure processing an inbound envelope, deserialization error, or resource-limit queue failure on a v5 connection.","commonSituations":"Exercising protocol v5 with the simple test client (which is intended for tests, not production); unexpected server frames or deserialization bugs in test tooling.","solutions":["Inspect the wrapped cause (RuntimeException.getCause()) to find the real handler failure.","Avoid protocol v5 features with SimpleClient, or downgrade the negotiated version.","Report the underlying deserialization/handler bug if it stems from a server frame; SimpleClient is a test client, prefer the java driver for real workloads.","Patch SimpleClient's errorHandler to log and close the channel rather than rethrow if you need resilience."],"exampleFix":"// before\nCQLMessageHandler.ErrorHandler errorHandler = (error) -> {\n    throw new RuntimeException(\"Unexpected error\", error);\n};\n// after\nCQLMessageHandler.ErrorHandler errorHandler = (error) -> {\n    logger.error(\"Handler error, closing channel\", error);\n    ctx.close();\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { v5Operation(); } catch (RuntimeException e) { if (e.getCause() != null) handleHandlerError(e.getCause()); }","preventionTips":["Don't use SimpleClient for protocol v5 production workloads","Always inspect getCause() — this exception only wraps the real failure","Prefer the java driver for v5 features"],"tags":["protocol-v5","netty","native-protocol","test-client"],"backgroundTag":"internal-invariant-violation","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"}