{"record":{"id":"59c7373ab018049d","repo":"dotnet/aspnetcore","slug":"invalid-payload-for-invocation-message-59c737","errorCode":null,"errorMessage":"Invalid payload for Invocation message.","messagePattern":"Invalid payload for Invocation message\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/ts/signalr/src/JsonHubProtocol.ts","lineNumber":135,"sourceCode":"\n        this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\n    }\n\n    private _isAckMessage(message: AckMessage): void {\n        if (typeof message.sequenceId !== 'number') {\n            throw new Error(\"Invalid SequenceId for Ack message.\");\n        }\n    }\n\n    private _isSequenceMessage(message: SequenceMessage): void {\n        if (typeof message.sequenceId !== 'number') {\n            throw new Error(\"Invalid SequenceId for Sequence message.\");\n        }\n    }\n\n    private _assertNotEmptyString(value: any, errorMessage: string): void {\n        if (typeof value !== \"string\" || value === \"\") {\n            throw new Error(errorMessage);\n        }\n    }\n}\n","sourceCodeStart":117,"sourceCodeEnd":139,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/SignalR/clients/ts/signalr/src/JsonHubProtocol.ts#L117-L139","documentation":"An Invocation message (type 1) must name the target method in a non-empty string, and if an invocationId is supplied it too must be non-empty. _assertNotEmptyString (line 133) throws this message when target or invocationId is missing, empty, or not a string.","triggerScenarios":"Server sends {\"type\":1,\"arguments\":[...]} with no target, or an invocationId of \"\". Also from a custom server that builds invocations with a blank target.","commonSituations":"Server hub method name resolves to empty, a dynamic-dispatch server forwards a message without setting target, or protocol version mismatch alters the field layout.","solutions":["Ensure the server always sets a non-empty target method name on every invocation.","Check for a proxy or serializer dropping the target field.","Log the raw message (logMessageContent:true) to confirm target presence.","Confirm client and server use compatible protocol versions."],"exampleFix":"// before\n{ \"type\": 1, \"arguments\": [1] } // missing target\n\n// after\n{ \"type\": 1, \"target\": \"DoWork\", \"arguments\": [1] }","handlingStrategy":"validation","validationCode":"function validInvocation(m: any): boolean {\n  return typeof m?.target === 'string' && m.target.length > 0\n    && (m.invocationId === undefined || (typeof m.invocationId === 'string' && m.invocationId.length > 0));\n}","typeGuard":"function isInvocationMessage(m: any): m is { type: 1; target: string } {\n  return typeof m?.target === 'string' && m.target !== '';\n}","tryCatchPattern":null,"preventionTips":["Servers must always set a non-empty target on every invocation.","Register client handlers for every method the server invokes to avoid silent drops.","Log raw messages when integrating a custom server."],"tags":["typescript","signalr","protocol","validation","invocation"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}