dotnet/aspnetcore · error · RuntimeException
Invalid invocation result kind.
Error message
Invalid invocation result kind.
What it means
A CompletionMessage carries a resultKind of 1 (error), 2 (void), or 3 (non-void). If the unpacker reads any other integer for resultKind, the completion is malformed and cannot be interpreted, so parsing throws.
Source
Thrown at src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java:260
Map<String, String> headers = readHeaders(unpacker);
String invocationId = unpacker.unpackString();
int resultKind = unpacker.unpackInt();
String error = null;
Object result = null;
switch (resultKind) {
case ERROR_RESULT:
error = unpacker.unpackString();
break;
case VOID_RESULT:
break;
case NON_VOID_RESULT:
Type itemType = binder.getReturnType(invocationId);
result = readValue(unpacker, itemType, payload, true);
break;
default:
throw new RuntimeException("Invalid invocation result kind.");
}
return new CompletionMessage(headers, invocationId, result, error);
}
private HubMessage createStreamInvocationMessage(MessageUnpacker unpacker, InvocationBinder binder, int itemCount, ByteBuffer payload) throws IOException {
Map<String, String> headers = readHeaders(unpacker);
String invocationId = unpacker.unpackString();
String target = unpacker.unpackString();
Object[] arguments = null;
try {
List<Type> types = binder.getParameterTypes(target);
arguments = bindArguments(unpacker, types, payload);
} catch (Exception ex) {
return new InvocationBindingFailureMessage(invocationId, target, ex);
}
View on GitHub (pinned to 294cab2f9b)
Solutions
- Use a matching SignalR server and client version.
- Validate that no proxy corrupts framing upstream.
- If streaming/invoke results fail consistently, capture the completion frame bytes.
Defensive patterns
Strategy: try-catch
Try / catch
// Java
hubConnection.invoke(new TypeReference<Result>(){}, "Method").subscribe(
ok -> {},
err -> {
if (err.getMessage() != null && err.getMessage().contains("result kind")) {
}
}); Prevention
- Keep server and client SignalR versions aligned.
- Ensure no proxy corrupts framing upstream.
- Capture the completion frame bytes if it recurs.
When it happens
Trigger: Server sends a CompletionMessage with a resultKind outside {1,2,3}; buffer misalignment that causes the wrong byte to be read as resultKind; protocol version mismatch.
Common situations: Server/client SignalR version mismatch; non-conformant server; upstream framing corruption shifting byte alignment.
Related errors
- Cannot read message size.
- MessagePack message was length %d but claimed to be length %
- Error reading length header.
- Error reading MessagePack data.
- Unexpected message type: %d
AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06).
Data as JSON: /api/errors/93492921ab3fe9b6.
Report an issue: GitHub.