{"record":{"id":"37474a897786411b","repo":"quarkusio/quarkus","slug":"can-only-work-with-quarkus-rest-instances-sseev","errorCode":null,"errorMessage":"Can only work with Quarkus-REST instances: ${sseEventSink}","messagePattern":"Can only work with Quarkus-REST instances: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java","lineNumber":69,"sourceCode":"        onErrorConsumers.add(onError);\n    }\n\n    @Override\n    public synchronized void onClose(Consumer<SseEventSink> onClose) {\n        Objects.requireNonNull(onClose);\n        checkClosed();\n        closeConsumers.add(onClose);\n    }\n\n    @Override\n    public synchronized void register(SseEventSink sseEventSink) {\n        Objects.requireNonNull(sseEventSink);\n        checkClosed();\n        readLock.lock();\n        try {\n            checkClosed();\n            if (!(sseEventSink instanceof SseEventSinkImpl sinkImpl)) {\n                throw new IllegalArgumentException(\"Can only work with Quarkus-REST instances: \" + sseEventSink);\n            }\n            sinkImpl.register(this);\n            outputQueue.add(sseEventSink);\n        } finally {\n            readLock.unlock();\n        }\n    }\n\n    @Override\n    public synchronized CompletionStage<?> broadcast(OutboundSseEvent event) {\n        Objects.requireNonNull(event);\n        checkClosed();\n\n        List<CompletableFuture<?>> cfs = new ArrayList<>(outputQueue.size());\n        for (SseEventSink eventSink : outputQueue) {\n            CompletionStage<?> cs;\n            try {\n                CompletionStage<?> sendStage = eventSink.send(event);","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java#L51-L87","documentation":"SseBroadcasterImpl.register() throws IllegalArgumentException when the supplied SseEventSink is not a Quarkus REST (RESTEasy Reactive) SseEventSinkImpl instance. The broadcaster manages internal queues and requires its own implementation, per the JAX-RS SSE contract which restricts broadcaster/sink mixing across providers.","triggerScenarios":"Calling sseBroadcaster.register(sink) with a sink obtained from a different JAX-RS provider, a mock, a custom SseEventSink implementation, or a test double.","commonSituations":"Unit tests injecting Mockito mocks for SseEventSink; mixing implementations when multiple REST frameworks are on the classpath; wrapping/decorating the sink in a proxy that breaks the instanceof check.","solutions":["Obtain the SseEventSink only via injection of the Sse/SseEventSink provided by Quarkus REST.","In tests, build real SseEventSinkImpl instances or use the Quarkus test facilities instead of mocks.","Remove wrapper/proxy layers around the sink before registering it.","Check classpath for conflicting JAX-RS implementations (e.g. classic RESTEasy) supplying their own SseEventSink."],"exampleFix":"// before\nSseEventSink sink = mock(SseEventSink.class);\nbroadcaster.register(sink); // IllegalArgumentException\n// after\n@Path(\"stream\")\nclass StreamResource {\n    @Inject Sse sse;\n    @GET @Produces(MediaType.SERVER_SENT_EVENTS)\n    public void stream(@Context SseEventSink sink) {\n        broadcaster.register(sink); // real Quarkus-REST sink\n    }\n}","handlingStrategy":"type-guard","validationCode":"if (!(sink instanceof SseEventSinkImpl)) {\n    throw new IllegalArgumentException(\"Register only Quarkus-REST SseEventSink instances\");\n}","typeGuard":"boolean isQuarkusSink(SseEventSink s) {\n    return s instanceof SseEventSinkImpl;\n}","tryCatchPattern":"try {\n    broadcaster.register(sink);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Non Quarkus sink rejected: \" + e.getMessage());\n}","preventionTips":["Only inject SseEventSink from Quarkus REST resources","Avoid mocking SseEventSink in tests; use real instances","Do not wrap sinks in proxies/decorators","Check for conflicting JAX-RS SSE implementations on the classpath"],"tags":["jaxrs","sse","resteasy-reactive","illegal-argument"],"backgroundTag":"incompatible-sse-implementation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}