{"record":{"id":"93492921ab3fe9b6","repo":"dotnet/aspnetcore","slug":"invalid-invocation-result-kind","errorCode":null,"errorMessage":"Invalid invocation result kind.","messagePattern":"Invalid invocation result kind\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java","lineNumber":260,"sourceCode":"        Map<String, String> headers = readHeaders(unpacker);\n        String invocationId = unpacker.unpackString();\n        int resultKind = unpacker.unpackInt();\n\n        String error = null;\n        Object result = null;\n\n        switch (resultKind) {\n            case ERROR_RESULT:\n                error = unpacker.unpackString();\n                break;\n            case VOID_RESULT:\n                break;\n            case NON_VOID_RESULT:\n                Type itemType = binder.getReturnType(invocationId);\n                result = readValue(unpacker, itemType, payload, true);\n                break;\n            default:\n                throw new RuntimeException(\"Invalid invocation result kind.\");\n        }\n\n        return new CompletionMessage(headers, invocationId, result, error);\n    }\n\n    private HubMessage createStreamInvocationMessage(MessageUnpacker unpacker, InvocationBinder binder, int itemCount, ByteBuffer payload) throws IOException {\n        Map<String, String> headers = readHeaders(unpacker);\n        String invocationId = unpacker.unpackString();\n        String target = unpacker.unpackString();\n\n        Object[] arguments = null;\n        try {\n            List<Type> types = binder.getParameterTypes(target);\n            arguments = bindArguments(unpacker, types, payload);\n        } catch (Exception ex) {\n            return new InvocationBindingFailureMessage(invocationId, target, ex);\n        }\n","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java#L242-L278","documentation":"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.","triggerScenarios":"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.","commonSituations":"Server/client SignalR version mismatch; non-conformant server; upstream framing corruption shifting byte alignment.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Java\nhubConnection.invoke(new TypeReference<Result>(){}, \"Method\").subscribe(\n    ok -> {},\n    err -> {\n        if (err.getMessage() != null && err.getMessage().contains(\"result kind\")) {\n        }\n    });","preventionTips":["Keep server and client SignalR versions aligned.","Ensure no proxy corrupts framing upstream.","Capture the completion frame bytes if it recurs."],"tags":["signalr","messagepack","protocol","completion"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}