mastra-ai/mastra · error

No snapshot found for this workflow run: ${this.workflowId}

Error message

No snapshot found for this workflow run: ${this.workflowId} ${this.runId}

What it means

Thrown during resume claim verification in workflow.ts: when a concurrent-update-enabled store's compare-and-set shows the snapshot status is no longer 'suspended', the code re-reads the snapshot to report the actual status. If that re-read returns nothing (snapshot deleted or missing), this plain Error is thrown. It means the workflow run's persisted snapshot cannot be found for the given workflowId/runId pair.

Source

Thrown at packages/core/src/workflows/workflow.ts:4366

    const claimed = await workflowsStore.updateWorkflowState({
      workflowName: this.workflowId,
      runId: this.runId,
      opts: { status: 'running', expectedStatus: 'suspended' },
    });

    if (claimed) {
      return;
    }

    // The compare-and-set found a status other than `suspended`. Re-read so the error names the
    // status the run actually landed in rather than guessing.
    const current = await workflowsStore.loadWorkflowSnapshot({
      workflowName: this.workflowId,
      runId: this.runId,
    });

    if (!current) {
      throw new Error('No snapshot found for this workflow run: ' + this.workflowId + ' ' + this.runId);
    }

    throw new MastraError({
      id: 'WORKFLOW_RESUME_ALREADY_CLAIMED',
      domain: ErrorDomain.MASTRA_WORKFLOW,
      category: ErrorCategory.USER,
      text:
        `This suspended workflow run was already resumed by another caller. Workflow "${this.workflowId}" run "${this.runId}" ` +
        `moved from "${snapshot.status}" to "${current.status}" before this resume could claim it. ` +
        `Only one resume() call may continue a given suspension; re-read the run state before resuming again.`,
      details: {
        workflowId: this.workflowId,
        runId: this.runId,
        expectedStatus: 'suspended',
        actualStatus: current.status ?? 'unknown',
      },
    });
  }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Verify the runId exists: inspect the workflow storage table (workflows_snapshots) for workflowName + runId before resuming.
  2. Check that the same storage/DB instance is used across processes (MASTRA_STORAGE / libsql/upstash config not pointing at two different DBs).
  3. Re-create the run if the snapshot was legitimately deleted; snapshots cannot be reconstructed.
  4. Confirm the storage adapter implements loadWorkflowSnapshot and supports concurrent updates if relying on claim semantics.

Example fix

// before
await run.resume({ resumeData, step: 'myStep' }); // throws: no snapshot
// after
const snapshot = await storage.loadWorkflowSnapshot({ workflowName: wf.id, runId: runId });
if (!snapshot) throw new Error(`Run ${runId} not found in storage`);
await run.resume({ resumeData, step: 'myStep' });
Defensive patterns

Strategy: try-catch

Validate before calling

const store = await mastra.getStorage()?.getStore('workflows');
const snapshot = await store?.loadWorkflowSnapshot({ workflowName: wf.id, runId });
if (!snapshot) throw new Error(`Run ${runId} has no snapshot; cannot resume`);

Type guard

function hasSnapshot(s: unknown): s is { status: string } {
  return !!s && typeof s === 'object' && 'status' in s;
}

Try / catch

try {
  await run.resume({ resumeData, step: 'myStep' });
} catch (e) {
  if (e instanceof Error && /No snapshot found for this workflow run/.test(e.message)) {
    // re-create the run or correct the storage config
  } else throw e;
}

Prevention

When it happens

Trigger: Calling workflow.resume() on a run whose snapshot was deleted from storage, or whose runId does not exist in the configured workflow store, after the optimistic status check found the run non-suspended.

Common situations: Wrong storage backend configured (e.g. in-memory store restarted, losing snapshots); runId typo or run created against a different Mastra instance; snapshot TTL/cleanup removed the run; pointing app at a different database than the one that created the run.

Related errors


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