dotnet/aspnetcore · error · UnsupportedOperationException

The message type is not supported yet.

Error message

The message type %s is not supported yet.

What it means

Thrown by GsonHubProtocol.parseMessages when an incoming wire message has type STREAM_INVOCATION or CANCEL_INVOCATION. Those message types are defined for the protocol but are client->server directions: a client should never receive them. Receiving one indicates the server is trying to invoke a streaming method on the client or cancel one, which the Java client does not support.

Solutions

  1. Move server-to-client streaming off the Java client, or use the .NET/JS client which supports it.
  2. If the server is yours, change the hub method to a regular invocation (SendAsync) or a client result only where supported.
  3. Confirm the message type the server is emitting; if it is Channel/IAsyncEnumerable toward the client, that path is unsupported here.

Example fix

// before: server pushes a stream to the Java client
// C# hub: Clients.Caller.SendAsync(...) on an IAsyncEnumerable -> STREAM_INVOCATION on wire

// after: server uses a non-streaming invocation
await Clients.Caller.SendAsync("ReceiveItem", item);
Defensive patterns

Strategy: fallback

Validate before calling

// Client-side: nothing to validate; the server chooses the message type.
// Document/forbid server-to-client streaming toward the Java client at design time.
boolean serverSupportsClientStreamingInbound = false; // set by platform matrix

Type guard

// No inbound type guard: the message type arrives on the wire.
// Prevent by not exposing streaming hub methods to Java clients.

Try / catch

try {
  conn.start().blockingAwait();
} catch (UnsupportedOperationException e) {
  if (e.getMessage() != null && e.getMessage().contains("not supported yet")) {
    // switch to a non-streaming server method, or use the .NET/JS client
  } else throw e;
}

Prevention

When it happens

Trigger: A server hub invokes a streaming method on the Java client (server-to-client streaming), or sends a CancelInvocation toward the client. The switch in parseMessages covers all HubMessageType values and throws UnsupportedOperationException for these two unsupported inbound cases.

Common situations: Server-side code calls Clients.Caller.SendAsync on a streaming method, or a hub uses IAsyncEnumerable/IAsyncStreaming toward the Java client; mixing the Java client with a server that assumes bidirectional streaming support that only the .NET/JS clients provide.

Related errors


AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11). Data as JSON: /api/errors/00fa0ba2b7ca21e2. Report an issue: GitHub.

Appendix: source

Thrown at src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/GsonHubProtocol.java:204

                        break;
                    case STREAM_ITEM:
                        if (resultToken != null) {
                            Type returnType = binder.getReturnType(invocationId);
                            try {
                                result = gson.fromJson(resultToken, returnType != null ? returnType : Object.class);
                            } catch (Exception ex) {
                                argumentBindingException = ex;
                            }
                        }
                        if (argumentBindingException != null) {
                            hubMessages.add(new StreamBindingFailureMessage(invocationId, argumentBindingException));
                        } else {
                            hubMessages.add(new StreamItem(null, invocationId, result));
                        }
                        break;
                    case STREAM_INVOCATION:
                    case CANCEL_INVOCATION:
                        throw new UnsupportedOperationException(String.format("The message type %s is not supported yet.", messageType));
                    case PING:
                        hubMessages.add(PingMessage.getInstance());
                        break;
                    case CLOSE:
                        if (error != null) {
                            hubMessages.add(new CloseMessage(error));
                        } else {
                            hubMessages.add(new CloseMessage());
                        }
                        break;
                    default:
                        break;
                }
            }
        } catch (IOException ex) {
            throw new RuntimeException("Error reading JSON.", ex);
        }

View on GitHub (pinned to 3600ca084e)