{"record":{"id":"aa04e555e535fbd8","repo":"mastra-ai/mastra","slug":"this-workflow-run-was-not-suspended-aa04e5","errorCode":null,"errorMessage":"This workflow run was not suspended","messagePattern":"This workflow run was not suspended","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/workflows/evented/workflow.ts","lineNumber":2336,"sourceCode":"          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    if (!workflowsStore) {\n      throw new Error('Cannot resume workflow: workflows store is required');\n    }\n    const snapshot = await waitForSuspendedSnapshot(workflowsStore, this.workflowId, this.runId);\n    if (!snapshot) {\n      throw new Error(`Cannot resume workflow: no snapshot found for runId ${this.runId}`);\n    }\n\n    // Check if workflow is suspended before proceeding\n    if (snapshot.status !== 'suspended') {\n      throw new Error('This workflow run was not suspended');\n    }\n\n    // Resolve label to step path if provided\n    const snapshotResumeLabel = params.label ? snapshot?.resumeLabels?.[params.label] : undefined;\n\n    // Validate label exists if provided\n    if (params.label && !snapshotResumeLabel) {\n      const availableLabels = Object.keys(snapshot?.resumeLabels ?? {});\n      throw new Error(\n        `Resume label \"${params.label}\" not found. ` + `Available labels: [${availableLabels.join(', ')}]`,\n      );\n    }\n\n    // Label takes precedence over step param\n    const stepParam = snapshotResumeLabel?.stepId ?? params.step;\n\n    // Auto-detect suspended steps if no step is provided\n    let steps: string[];","sourceCodeStart":2318,"sourceCodeEnd":2354,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workflows/evented/workflow.ts#L2318-L2354","documentation":"resume() only makes sense for runs parked at a suspend point. The snapshot was found in storage but its status is not 'suspended' (e.g. 'running', 'success', 'failed'), so resuming would be meaningless and the library throws.","triggerScenarios":"Calling resume() on a run whose persisted snapshot.status !== 'suspended' — the run already completed, already failed, is still actively running, or was resumed previously.","commonSituations":"Double-resume from a retry queue or duplicate event handler; user clicking 'resume' twice in a UI; resuming after the workflow already finished because a watch loop didn't observe completion; stale UI state showing an old suspended run.","solutions":["Check the run status before resuming and skip if not 'suspended'","Deduplicate resume calls (idempotency key or in-flight guard)","Fetch the run's latest snapshot to see the actual status and outcome (success/error) instead of resuming"],"exampleFix":"// before\nawait workflow.resume({ runId, step, resumeData });\n// after\nconst snapshot = await storage.loadWorkflowSnapshot({ workflowId, runId });\nif (snapshot?.status === 'suspended') {\n  await workflow.resume({ runId, step, resumeData });\n}","handlingStrategy":"validation","validationCode":"const snapshot = await storage.loadWorkflowSnapshot({ workflowId, runId });\nif (snapshot?.status !== 'suspended') {\n  throw new Error(`Run is ${snapshot?.status}; only suspended runs can be resumed`);\n}","typeGuard":"function isSuspended(s) {\n  return !!s && s.status === 'suspended';\n}","tryCatchPattern":"try {\n  await run.resume({ runId, step, resumeData });\n} catch (e) {\n  if (e.message === 'This workflow run was not suspended') {\n    // treat as idempotent no-op or fetch final result\n    return getRunResult(runId);\n  }\n  throw e;\n}","preventionTips":["Guard resume paths with a status check","Deduplicate resume triggers (disable UI button after click, idempotency keys)","Refresh run state before offering resume actions"],"tags":["workflow","resume","state"],"backgroundTag":"workflow-not-suspended","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}