{"record":{"id":"095a39b995f10489","repo":"mastra-ai/mastra","slug":"failed-to-resume-agent-builder-action-stream-re","errorCode":null,"errorMessage":"Failed to resume agent builder action stream: ${response.statusText}","messagePattern":"Failed to resume agent builder action stream: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client-sdks/client-js/src/resources/agent-builder.ts","lineNumber":295,"sourceCode":"    step: string | string[];\n    resumeData?: unknown;\n    requestContext?: RequestContext;\n  }): Promise<globalThis.ReadableStream<{ type: string; payload: any }>> {\n    const searchParams = new URLSearchParams();\n    searchParams.set('runId', params.runId);\n\n    const requestContext = parseClientRequestContext(params.requestContext);\n    const { runId: _, requestContext: __, ...resumeParams } = params;\n\n    const url = `/agent-builder/${this.actionId}/resume-stream?${searchParams.toString()}`;\n    const response: Response = await this.request(url, {\n      method: 'POST',\n      body: { ...resumeParams, requestContext },\n      stream: true,\n    });\n\n    if (!response.ok) {\n      throw new Error(`Failed to resume agent builder action stream: ${response.statusText}`);\n    }\n\n    if (!response.body) {\n      throw new Error('Response body is null');\n    }\n\n    return response.body.pipeThrough(this.createRecordParserTransform());\n  }\n\n  /**\n   * Gets a specific action run by its ID.\n   * This calls `/agent-builder/:actionId/runs/:runId`.\n   * @param runId - The ID of the action run to retrieve\n   * @param options - Optional configuration\n   * @param options.fields - Optional array of fields to return (e.g., ['result', 'steps']). Available fields: result, error, payload, steps, activeStepsPath, serializedStepGraph. Metadata fields (runId, workflowName, resourceId, createdAt, updatedAt) and status are always included.\n   * @param options.withNestedWorkflows - Whether to include nested workflow data in steps. Defaults to true. Set to false for better performance when you don't need nested workflow details.\n   * @returns Promise containing the action run details with metadata and processed execution state\n   */","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/client-sdks/client-js/src/resources/agent-builder.ts#L277-L313","documentation":"resumeStream() POSTs resume parameters (plus requestContext) to the agent-builder resume endpoint with stream:true and throws this error when the response status is not ok. It guards against the server rejecting a resume of a suspended agent-builder action before any stream chunks arrive.","triggerScenarios":"Calling resumeStream() with an invalid/expired suspend token or run id, resuming a run that already completed or failed, auth errors, or the server returning 4xx/5xx for the resume POST.","commonSituations":"Resuming a workflow/action after server restart lost the suspended run; resuming after the resume snapshot expired; mismatched requestContext causing 400; server deployed without the resume route.","solutions":["Inspect server logs/status for the resume request; validate the suspend payload and run id are current.","Confirm the suspended run still exists server-side (not completed/expired); otherwise start a new run instead of resuming.","Check that resumeParams match the server's expected schema (version mismatch between SDK and server).","Retry with backoff for transient 5xx.","Wrap in try/catch, and on failure re-observe via observeStream or restart the action."],"exampleFix":"// before\nconst stream = await builder.resumeStream(resumeParams); // throws on non-ok\n// after\ntry {\n  const stream = await builder.resumeStream(resumeParams);\n} catch (e) {\n  console.error('resume failed:', (e as Error).message, '— run may be gone; restarting action');\n  const fresh = await builder.stream(startParams);\n}","handlingStrategy":"try-catch","validationCode":"// validate resume payload is complete before calling\nif (!resumeParams?.runId || !resumeParams?.resumeData) {\n  throw new Error('resumeParams must include runId and resumeData before resuming');\n}","typeGuard":"function canResume(p: unknown): p is { runId: string; resumeData: unknown } {\n  return !!p && typeof p === 'object' && 'runId' in p && typeof (p as any).runId === 'string';\n}","tryCatchPattern":"try {\n  const stream = await builder.resumeStream(resumeParams);\n} catch (err) {\n  console.error(`resume failed: ${(err as Error).message}`);\n  // on 4xx (run gone/expired) restart the action; on 5xx retry with backoff\n}","preventionTips":["Resume promptly; suspended runs may expire or be lost on restart","Validate the run still exists server-side before resuming","Keep resumeParams schema in sync with server version","Fall back to starting a new run when resume is rejected"],"tags":["http","streaming","resume","network"],"backgroundTag":"http-non-ok-response","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}