{"record":{"id":"3cebb903c22c0d80","repo":"mastra-ai/mastra","slug":"runid-required-to-resume-workflow","errorCode":null,"errorMessage":"runId required to resume workflow","messagePattern":"runId required to resume workflow","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"packages/server/src/server/handlers/workflows.ts","lineNumber":628,"sourceCode":"  responseType: 'stream',\n  pathParamSchema: workflowIdPathParams,\n  queryParamSchema: runIdSchema,\n  bodySchema: resumeBodySchema,\n  responseSchema: streamResponseSchema,\n  summary: 'Resume workflow stream',\n  description: 'Resumes a suspended workflow execution and continues streaming results',\n  tags: ['Workflows'],\n  requiresAuth: true,\n  handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {\n    try {\n      const effectiveResourceId = getEffectiveResourceId(requestContext, undefined);\n\n      if (!workflowId) {\n        throw new HTTPException(400, { message: 'Workflow ID is required' });\n      }\n\n      if (!runId) {\n        throw new HTTPException(400, { message: 'runId required to resume workflow' });\n      }\n\n      const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });\n\n      if (!workflow) {\n        throw new HTTPException(404, { message: 'Workflow not found' });\n      }\n\n      const run = await workflow.getWorkflowRunById(runId);\n\n      if (!run) {\n        throw new HTTPException(404, { message: 'Workflow run not found' });\n      }\n\n      await validateRunOwnership(run, effectiveResourceId);\n\n      const _run = await workflow.createRun({ runId, resourceId: run.resourceId });\n      const serverCache = mastra.getServerCache();","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/workflows.ts#L610-L646","documentation":"Thrown by the resume handler when `runId` is missing after the workflowId check passes. Resuming a suspended workflow requires the specific run to resume, so the server rejects with HTTP 400 before touching storage.","triggerScenarios":"POST to the resume endpoint without a runId in path/body; calling the SDK resume method without the run identifier; runId variable undefined because the suspended-run handle was lost (e.g. not persisted by the caller).","commonSituations":"After a server restart the caller no longer knows the runId and sends an empty value; passing the workflow id in place of the run id by mistake; forgetting to persist runId when initiating the workflow.","solutions":["Pass the runId of the suspended run to the resume call.","Persist the runId returned from `workflow.createRun()`/`start()` so it is available at resume time.","Look up existing runs for the workflow (runs list API) if the runId was lost."],"exampleFix":"// before\nawait workflow.resume({ resumeData }) // runId missing\n// after\nawait workflow.resume({ runId, step: 'approval', resumeData })","handlingStrategy":"validation","validationCode":"if (!runId || typeof runId !== 'string') {\n  throw new TypeError('runId is required to resume a suspended workflow run');\n}\nawait client.resumeWorkflow(workflowId, runId, { resumeData });","typeGuard":"function isRunId(x: unknown): x is string {\n  return typeof x === 'string' && x.trim().length > 0;\n}","tryCatchPattern":"try {\n  await workflow.resume({ runId, resumeData });\n} catch (e) {\n  if (e instanceof MastraClientError && e.status === 400 && /runId/.test(e.message)) {\n    console.error('Resume call missing runId; did you persist it at createRun time?');\n  }\n  throw e;\n}","preventionTips":["Always capture and persist the runId returned when the run is created.","Never construct resume calls from variables that may be undefined without checking.","Store the runId in durable state (DB row, job payload) so suspension/resume can span processes."],"tags":["http-400","validation","missing-parameter","workflow-run"],"backgroundTag":"missing-required-param","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}