{"record":{"id":"a89007714c9836ad","repo":"mastra-ai/mastra","slug":"a2a-method-stream-response-did-not-include-a-bo","errorCode":null,"errorMessage":"A2A ${method} stream response did not include a body (status: ${response.status} ${response.statusText})","messagePattern":"A2A (.+?) stream response did not include a body \\(status: (.+?) (.+?)\\)","errorType":"http","errorClass":"MastraClientErrorClass","httpStatus":null,"severity":"error","filePath":"client-sdks/client-js/src/resources/a2a.ts","lineNumber":116,"sourceCode":"    .join(', ');\n\n  let responseText = '';\n  try {\n    responseText = await response.text();\n  } catch {\n    // Ignore body read failures and surface the rest of the response context.\n  }\n\n  const details = [\n    `A2A ${method} stream response did not include a body`,\n    `(status: ${response.status} ${response.statusText})`,\n    headerSummary ? `headers: ${headerSummary}` : '',\n    responseText ? `body: ${responseText}` : '',\n  ]\n    .filter(Boolean)\n    .join(' ');\n\n  throw new MastraClientErrorClass(response.status, response.statusText, details);\n}\n\n/**\n * Class for interacting with an agent via the A2A protocol\n */\nexport class A2A extends BaseResource {\n  constructor(\n    options: ClientOptions,\n    private agentId: string,\n  ) {\n    super(options);\n  }\n\n  /**\n   * Get the agent card with metadata about the agent.\n   * @param options - Optional Agent Card verification settings\n   * @returns Promise containing the agent card information\n   */","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/client-sdks/client-js/src/resources/a2a.ts#L98-L134","documentation":"requireResponseBody guards A2A streaming calls (sendMessageStream, resubscribeTask): a streaming response must expose a ReadableStream body. When body is null, it throws a MastraClientError including status, statusText, sanitized headers, and (when available) response text to aid debugging.","triggerScenarios":"Calling a2a.sendMessageStream(...) or resubscribeTask(...) where the HTTP response has no body: 204/304-style empty responses, server not supporting streaming, or a runtime/polyfill producing bodyless Response objects.","commonSituations":"A2A server returning a non-streaming error response with empty body; fetch polyfill in a constrained runtime; middleware consuming the stream before the client sees it.","solutions":["Read the status/details embedded in the thrown MastraClientError (headers, body text) to identify the server-side cause.","Confirm the A2A server supports streaming responses for the invoked method.","Use a runtime with native streaming fetch (Node 18+, modern browsers).","For persistent failures, fall back to the non-streaming sendMessage and poll for task updates."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function hasBody(res: Response): res is Response & { body: ReadableStream<Uint8Array> } {\n  return res.body !== null;\n}","tryCatchPattern":"try {\n  const events = await a2a.sendMessageStream(msg);\n} catch (e) {\n  if (e instanceof MastraClientError && e.message.includes('did not include a body')) {\n    // fall back to non-streaming sendMessage + task polling\n  }\n  throw e;\n}","preventionTips":["Confirm the A2A server supports streaming for the method invoked.","Use native streaming fetch runtimes.","Implement a non-streaming fallback path for constrained environments."],"tags":["a2a","streaming","http"],"backgroundTag":"empty-response-body","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}