{"record":{"id":"34f71f6cbad59d6e","repo":"dotnet/aspnetcore","slug":"errormessage","errorCode":null,"errorMessage":"errorMessage","messagePattern":"errorMessage","errorType":"validation","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/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/SignalR/clients/ts/signalr/src/JsonHubProtocol.ts#L117-L139","documentation":"Generic not-empty-string assertion thrown by JsonHubProtocol._assertNotEmptyString. It is invoked from _isInvocationMessage (for `target` and, when present, `invocationId`) and reused across the other validators. The thrown message is whatever the caller passed as `errorMessage` (e.g. \"Invalid payload for Invocation message.\"), so this entry covers the assertion helper itself — any time a hub message field expected to be a non-empty string is missing, empty, or non-string.","triggerScenarios":"An Invocation message with an empty/missing/non-string `target`, or an Invocation message that includes an `invocationId` which is empty or non-string. The helper fires whenever `typeof value !== \"string\" || value === \"\"`.","commonSituations":"Server invokes a client method without a target name, a serializer drops the target field, or a malformed/injected hub message is parsed. Most often a protocol-version mismatch or a hand-rolled server.","solutions":["Ensure every Invocation message includes a non-empty string `target` (the hub method name).","When invocationId is used, make it a non-empty string.","Verify protocol compatibility and that no proxy strips these fields."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"function validInvocation(m: any): boolean {\n  if (typeof m.target !== \"string\" || m.target === \"\") return false;\n  if (m.invocationId !== undefined && (typeof m.invocationId !== \"string\" || m.invocationId === \"\")) return false;\n  return true;\n}","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === \"string\" && v.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always populate target with a non-empty hub method name.","When using invocationId, make it a non-empty string.","Validate frames in interoperability layers."],"tags":["protocol","json","validation","parsing","message-type"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}