dotnet/aspnetcore · error · UnsupportedOperationException

The message type %s is not supported yet.

Error message

The message type %s is not supported yet.

What it means

The client-side GsonHubProtocol intentionally does not implement reception of STREAM_INVOCATION (type 4) or CANCEL_INVOCATION (type 5) because those are client-to-server messages. Receiving one means the server is misbehaving (sending a message type that only clients should send) and the protocol throws rather than silently ignoring it.

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 294cab2f9b)

Solutions

  1. Report/investigate the server: it should never send StreamInvocation or CancelInvocation to clients.
  2. Upgrade both client and server to compatible SignalR versions.
  3. If testing, ensure fixtures only send client-receivable types (Invocation, StreamItem, Completion, Ping, Close).
  4. Inspect the wire for tampering if the server is known-good.

Example fix

// test fixture before
String msg = "{\"type\":4,\"invocationId\":\"1\"}\u001e";

// after (client-receivable type)
String msg = "{\"type\":1,\"target\":\"Do\",\"arguments\":[]}\u001e";
Defensive patterns

Strategy: fallback

Validate before calling

// Ensure test fixtures only emit client-receivable types
static final Set<Integer> CLIENT_RECEIVABLE = Set.of(1, 2, 3, 6, 7);
boolean clientReceivable(int type) { return CLIENT_RECEIVABLE.contains(type); }

Try / catch

try {
  connection.start();
} catch (RuntimeException e) {
  if (e.getMessage().contains("not supported yet")) {
    // server is sending client-only message types; report server bug
  }
}

Prevention

When it happens

Trigger: A server erroneously dispatching a StreamInvocation or CancelInvocation to the client, or a tampered/incorrect stream that injects type 4/5 messages.

Common situations: Server bug dispatching the wrong direction, protocol version mismatch, a malicious or buggy intermediary, or testing with a fixture that sends client-only message types.

Related errors


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