{"record":{"id":"40b49439a8c6e80d","repo":"quarkusio/quarkus","slug":"onpongmessage-callback-must-accept-exactly-one-me","errorCode":null,"errorMessage":"@OnPongMessage callback must accept exactly one message parameter of type io.vertx.core.buffer.Buffer: ","messagePattern":"@OnPongMessage callback must accept exactly one message parameter of type io\\.vertx\\.core\\.buffer\\.Buffer: ","errorType":"validation","errorClass":"WebSocketServerException","httpStatus":null,"severity":"error","filePath":"extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/WebSocketProcessor.java","lineNumber":1115,"sourceCode":"        }\n    }\n\n    private void validateOnPongMessage(Callback callback) {\n        if (KotlinUtils.isKotlinMethod(callback.method)) {\n            if (!callback.isReturnTypeVoid() && !isUniVoid(callback.returnType())\n                    && !callback.isKotlinSuspendFunctionReturningUnit()) {\n                throw new WebSocketServerException(\n                        \"@OnPongMessage callback must return Unit or Uni<Void>: \" + callback.asString());\n            }\n        } else {\n            if (!callback.isReturnTypeVoid() && !isUniVoid(callback.returnType())) {\n                throw new WebSocketServerException(\n                        \"@OnPongMessage callback must return void or Uni<Void>: \" + callback.asString());\n            }\n        }\n        Type messageType = callback.argumentType(MessageCallbackArgument::isMessage);\n        if (messageType == null || !messageType.name().equals(WebSocketDotNames.BUFFER)) {\n            throw new WebSocketServerException(\n                    \"@OnPongMessage callback must accept exactly one message parameter of type io.vertx.core.buffer.Buffer: \"\n                            + callback.asString());\n        }\n    }\n\n    private void validateOnClose(Callback callback) {\n        if (KotlinUtils.isKotlinMethod(callback.method)) {\n            if (!callback.isReturnTypeVoid() && !isUniVoid(callback.returnType())\n                    && !callback.isKotlinSuspendFunctionReturningUnit()) {\n                throw new WebSocketServerException(\n                        \"@OnClose callback must return Unit or Uni<Void>: \" + callback.asString());\n            }\n        } else {\n            if (!callback.isReturnTypeVoid() && !isUniVoid(callback.returnType())) {\n                throw new WebSocketServerException(\n                        \"@OnClose callback must return void or Uni<Void>: \" + callback.asString());\n            }\n        }","sourceCodeStart":1097,"sourceCodeEnd":1133,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/WebSocketProcessor.java#L1097-L1133","documentation":"Quarkus websockets-next requires an @OnPongMessage callback to accept exactly one message parameter of type io.vertx.core.buffer.Buffer — pong frames carry raw binary data, so only Buffer is supported. The build fails if the callback takes zero parameters, multiple parameters, or a message parameter of a different type.","triggerScenarios":"@OnPongMessage method with no parameters; @OnPongMessage with a String, byte[], or JsonObject message parameter; @OnPongMessage with extra parameters that are not recognized as message-typed (only one isMessage argument allowed and it must be Buffer).","commonSituations":"Developer assumes pong callbacks mirror @OnTextMessage and declares String or byte[] payload; developer omits the parameter entirely; a refactor changes the parameter type.","solutions":["Declare exactly one message parameter of type io.vertx.core.buffer.Buffer","If you need text, convert inside the method: data.toString() or data.getBytes()","Remove extra parameters or use supported injected types per the callback-arguments rules (the message slot itself must be Buffer)"],"exampleFix":"// before\n@OnPongMessage\nvoid onPong(String data) { }\n\n// after\nimport io.vertx.core.buffer.Buffer;\n@OnPongMessage\nvoid onPong(Buffer data) { }\n","handlingStrategy":"validation","validationCode":"// Verify the pong callback signature\n@OnPongMessage void onPong(io.vertx.core.buffer.Buffer data) {} // only Buffer allowed","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize: pong payload is always io.vertx.core.buffer.Buffer","Convert to String/bytes inside the method body","Keep exactly one parameter besides supported injected types"],"tags":["quarkus","websockets-next","build-time-validation","callback-signature"],"backgroundTag":"callback-parameter-type-mismatch","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}