mastra-ai/mastra · error · Error

Cannot resume workflow: no snapshot found for runId ${this.r

Error message

Cannot resume workflow: no snapshot found for runId ${this.runId}

What it means

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.

Source

Thrown at packages/core/src/workflows/evented/workflow.ts:2331

        actor: params.actor,
        context: {
          resourceId: this.resourceId,
        },
        metadata: {
          workflowId: this.workflowId,
          runId: this.runId,
          resourceId: this.resourceId,
        },
      });
    }

    const workflowsStore = await this.mastra?.getStorage()?.getStore('workflows');
    if (!workflowsStore) {
      throw new Error('Cannot resume workflow: workflows store is required');
    }
    const snapshot = await waitForSuspendedSnapshot(workflowsStore, this.workflowId, this.runId);
    if (!snapshot) {
      throw new Error(`Cannot resume workflow: no snapshot found for runId ${this.runId}`);
    }

    // Check if workflow is suspended before proceeding
    if (snapshot.status !== 'suspended') {
      throw new Error('This workflow run was not suspended');
    }

    // Resolve label to step path if provided
    const snapshotResumeLabel = params.label ? snapshot?.resumeLabels?.[params.label] : undefined;

    // Validate label exists if provided
    if (params.label && !snapshotResumeLabel) {
      const availableLabels = Object.keys(snapshot?.resumeLabels ?? {});
      throw new Error(
        `Resume label "${params.label}" not found. ` + `Available labels: [${availableLabels.join(', ')}]`,
      );
    }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Capture the runId returned by start() and confirm it matches the one passed to resume()
  2. Check storage contents (workflow_runs table) to verify the snapshot exists for that runId
  3. Ensure start and resume use the same storage backend and environment
  4. Wait for the run to reach 'suspended' before resuming (it may not have persisted suspension state yet)

Example fix

// before
await workflow.resume({ runId: guessId, step: stepA, resumeData });
// after
const { runId } = await run.start({ inputData });
const status = await run.getWorkflowRunStatus?.() ?? (await storage.persistWorkflowSnapshot(...), 'check');
await workflow.resume({ runId, step: stepA, resumeData });
Defensive patterns

Strategy: validation

Validate before calling

const snapshot = await storage.loadWorkflowSnapshot({ workflowId, runId });
if (!snapshot) throw new Error(`No persisted run ${runId}; cannot resume`);

Type guard

null

Try / catch

try {
  await run.resume({ runId, step, resumeData });
} catch (e) {
  if (e.message.includes('no snapshot found')) {
    // start a fresh run or alert — the runId is unknown to storage
    throw new Error(`Run ${runId} not found in storage; verify runId and storage backend`, { cause: e });
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/f9d25e8acf23b2b6. Report an issue: GitHub.