quarkusio/quarkus · error · WebSocketException

Unable to inject @%s callback parameter '%s' declared on %s:

Error message

Unable to inject @%s callback parameter '%s' declared on %s: no injector found

What it means

At build time websockets-next resolves each parameter of an @WebSocket/@WebSocketClient callback (onOpen/onMessage/onClose/onError) by matching it against registered ParameterConverters (injectors). When no parameter injector matches the annotation and type of a parameter, the build fails with WebSocketException. This catches unsupported callback parameter types/annotations early.

Source

Thrown at extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/Callback.java:210

    }

    private List<CallbackArgument> collectArguments(AnnotationInstance annotation, MethodInfo method,
            CallbackArgumentsBuildItem callbackArguments, TransformedAnnotationsBuildItem transformedAnnotations,
            IndexView index) {
        List<MethodParameterInfo> parameters = method.parameters();
        if (parameters.isEmpty()) {
            return List.of();
        }
        List<CallbackArgument> arguments = new ArrayList<>(parameters.size());
        for (MethodParameterInfo parameter : parameters) {
            List<CallbackArgument> found = callbackArguments
                    .findMatching(parameterContext(annotation, parameter, transformedAnnotations, index));
            if (found.isEmpty()) {
                String msg = String.format("Unable to inject @%s callback parameter '%s' declared on %s: no injector found",
                        DotNames.simpleName(annotation.name()),
                        parameter.name() != null ? parameter.name() : "#" + parameter.position(),
                        asString());
                throw new WebSocketException(msg);
            } else if (found.size() > 1 && (found.get(0).priority() == found.get(1).priority())) {
                String msg = String.format(
                        "Unable to inject @%s callback parameter '%s' declared on %s: ambiguous injectors found: %s",
                        DotNames.simpleName(annotation.name()),
                        parameter.name() != null ? parameter.name() : "#" + parameter.position(),
                        asString(),
                        found.stream().map(p -> p.getClass().getSimpleName() + ":" + p.priority()));
                throw new WebSocketException(msg);
            }
            arguments.add(found.get(0));
        }
        return List.copyOf(arguments);
    }

    Type argumentType(Predicate<CallbackArgument> filter) {
        for (int i = 0; i < arguments.size(); i++) {
            if (filter.test(arguments.get(i))) {
                return method.parameterType(i);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change the parameter to a supported type for that annotation (e.g. String for @PathParam)
  2. Remove the annotation if the parameter does not need injection and use a supported type (WebSocketConnection, Incoming/Message, etc.)
  3. Check the websockets-next documentation for the list of supported callback parameter kinds and their annotations
  4. Upgrade the extension version — new parameter injectors are added over time

Example fix

// before
@OnMessage
void onMessage(@PathParam("id") UUID id, String msg) { }
// after
@OnMessage
void onMessage(@PathParam("id") String id, String msg) { }
Defensive patterns

Strategy: validation

Validate before calling

// Before the build, check each callback param annotation+type pair
// against the supported table (String for @PathParam, WebSocketConnection, etc.)

Prevention

When it happens

Trigger: Declaring a callback method parameter annotated with a supported injection annotation (e.g. @PathParam, @HeaderParam, @Message) but with a type for which no injector is registered, or using an annotation no ParameterConverter handles.

Common situations: Typos or custom annotations on callback parameters; unsupported parameter types (e.g. custom classes where only String/byte[]/specific types are supported); using an annotation in a context where its injector is not registered (e.g. on the wrong callback kind).

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/5a495d31e4c54bc3. Report an issue: GitHub.