{"record":{"id":"f9d25e8acf23b2b6","repo":"mastra-ai/mastra","slug":"cannot-resume-workflow-no-snapshot-found-for-runi","errorCode":null,"errorMessage":"Cannot resume workflow: no snapshot found for runId ${this.runId}","messagePattern":"Cannot resume workflow: no snapshot found for runId (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/workflows/evented/workflow.ts","lineNumber":2331,"sourceCode":"        actor: params.actor,\n        context: {\n          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    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","sourceCodeStart":2313,"sourceCodeEnd":2349,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workflows/evented/workflow.ts#L2313-L2349","documentation":"After obtaining the workflows store, resume() polls for a persisted snapshot for this workflowId/runId via waitForSuspendedSnapshot. When none is found, the run either never persisted state, was started elsewhere, or the runId is wrong — so there is nothing to resume and the library throws.","triggerScenarios":"Calling resume() with a runId that has no snapshot in storage: the run was never started, storage was reset/swapped between start and resume, the run belongs to a different database/env, or the runId string is mistyped.","commonSituations":"Reusing a runId from memory after a dev server restart against an ephemeral DB; pointing dev and prod at different storages; waiting window in waitForSuspendedSnapshot elapsing because the run hasn't suspended yet or already finished and was cleaned up.","solutions":["Capture the runId returned by start() and confirm it matches the one passed to resume()","Check storage contents (workflow_runs table) to verify the snapshot exists for that runId","Ensure start and resume use the same storage backend and environment","Wait for the run to reach 'suspended' before resuming (it may not have persisted suspension state yet)"],"exampleFix":"// before\nawait workflow.resume({ runId: guessId, step: stepA, resumeData });\n// after\nconst { runId } = await run.start({ inputData });\nconst status = await run.getWorkflowRunStatus?.() ?? (await storage.persistWorkflowSnapshot(...), 'check');\nawait workflow.resume({ runId, step: stepA, resumeData });","handlingStrategy":"validation","validationCode":"const snapshot = await storage.loadWorkflowSnapshot({ workflowId, runId });\nif (!snapshot) throw new Error(`No persisted run ${runId}; cannot resume`);","typeGuard":"null","tryCatchPattern":"try {\n  await run.resume({ runId, step, resumeData });\n} catch (e) {\n  if (e.message.includes('no snapshot found')) {\n    // start a fresh run or alert — the runId is unknown to storage\n    throw new Error(`Run ${runId} not found in storage; verify runId and storage backend`, { cause: e });\n  }\n  throw e;\n}","preventionTips":["Persist the runId returned by start() durably before resuming","Use the same storage backend across start/resume and restarts","Wait for suspension before resuming; check run status first"],"tags":["workflow","storage","resume","missing-snapshot"],"backgroundTag":"workflow-run-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}