{"record":{"id":"6a4031cccbb4d8b4","repo":"mastra-ai/mastra","slug":"this-workflow-run-was-not-suspended-6a4031","errorCode":null,"errorMessage":"This workflow run was not suspended","messagePattern":"This workflow run was not suspended","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/workflows/workflow.ts","lineNumber":4442,"sourceCode":"          resourceId: this.resourceId,\n        },\n        metadata: {\n          workflowId: this.workflowId,\n          runId: this.runId,\n          resourceId: this.resourceId,\n        },\n      });\n    }\n\n    const workflowsStore = await this.#mastra?.getStorage()?.getStore('workflows');\n    const snapshot = await waitForSuspendedSnapshot(workflowsStore, this.workflowId, this.runId);\n\n    if (!snapshot) {\n      throw new Error('No snapshot found for this workflow run: ' + this.workflowId + ' ' + this.runId);\n    }\n\n    if (snapshot.status !== 'suspended') {\n      throw new Error('This workflow run was not suspended');\n    }\n\n    const snapshotResumeLabel = params.label ? snapshot?.resumeLabels?.[params.label] : undefined;\n    const stepParam = snapshotResumeLabel?.stepId ?? params.step;\n\n    // Auto-detect suspended steps if no step is provided\n    let steps: string[];\n    if (stepParam) {\n      let newStepParam = stepParam;\n      if (typeof stepParam === 'string') {\n        newStepParam = stepParam.split('.');\n      }\n      steps = (Array.isArray(newStepParam) ? newStepParam : [newStepParam]).map(step =>\n        typeof step === 'string' ? step : step?.id,\n      );\n    } else {\n      // Use suspendedPaths to detect suspended steps\n      const suspendedStepPaths: string[][] = [];","sourceCodeStart":4424,"sourceCodeEnd":4460,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workflows/workflow.ts#L4424-L4460","documentation":"Thrown by _resume() when the snapshot exists but its status is not 'suspended' — the run is in some other lifecycle state (running, completed, failed) and cannot be resumed.","triggerScenarios":"Calling resume() on a run that already completed or failed; resuming after another caller already resumed it (status 'running'); calling resume() before the workflow actually reached the suspend point (race after start()).","commonSituations":"Double resume after a webhook fires twice; resuming from a stale UI state; workflow finished while user had the resume page open; attempting resume on a failed run that needs a restart() instead.","solutions":["Load the run state first and only call resume() when status === 'suspended'.","For failed runs, use error handling/retry or restart(), not resume().","Update UI state after transitions so stale resume buttons are disabled.","Wait for the workflow to actually reach the suspend point (e.g. use the returned promise or watch status) before resuming."],"exampleFix":"// before\nawait run.resume({ resumeData, step: 'approve' });\n// after\nconst snapshot = await run.getWorkflowRunState();\nif (snapshot.status === 'suspended') {\n  await run.resume({ resumeData, step: 'approve' });\n}","handlingStrategy":"validation","validationCode":"const snapshot = await run.getWorkflowRunState();\nif (snapshot.status !== 'suspended') {\n  throw new Error(`Cannot resume: run status is ${snapshot.status}`);\n}","typeGuard":"function isSuspended(s: { status?: string }): boolean {\n  return s.status === 'suspended';\n}","tryCatchPattern":"try {\n  await run.resume({ resumeData, step });\n} catch (e) {\n  if (e instanceof Error && e.message === 'This workflow run was not suspended') {\n    // refresh UI state; skip resume or restart for failed runs\n  } else throw e;\n}","preventionTips":["Check run status immediately before resume and disable resume UI otherwise.","Only resume once per suspension event; use watched status transitions.","Use restart()/retry paths for failed runs, not resume().","Handle the promise returned by start() so you know when the run reached suspend."],"tags":["workflow","resume","state-machine","lifecycle"],"backgroundTag":"workflow-not-suspended","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}