{"record":{"id":"d32d16a7ed9177c6","repo":"mastra-ai/mastra","slug":"restart-is-not-supported-on-this-workflowengin","errorCode":null,"errorMessage":"restart() is not supported on ${this.workflowEngineType} workflows","messagePattern":"restart\\(\\) is not supported on (.+?) workflows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/workflows/workflow.ts","lineNumber":4709,"sourceCode":"    });\n  }\n\n  protected async _restart({\n    requestContext,\n    outputWriter,\n    tracingOptions,\n    actor,\n    ...rest\n  }: {\n    requestContext?: RequestContext<TRequestContext>;\n    outputWriter?: OutputWriter;\n    tracingOptions?: TracingOptions;\n    actor?: ActorSignal;\n  } & Partial<ObservabilityContext>): Promise<WorkflowResult<TState, TInput, TOutput, TSteps>> {\n    const observabilityContext = resolveObservabilityContext(rest);\n    const allowedEngines = ['default', 'evented'];\n    if (!allowedEngines.includes(this.workflowEngineType)) {\n      throw new Error(`restart() is not supported on ${this.workflowEngineType} workflows`);\n    }\n\n    const workflowsStore = await this.#mastra?.getStorage()?.getStore('workflows');\n    const snapshot = await workflowsStore?.loadWorkflowSnapshot({\n      workflowName: this.workflowId,\n      runId: this.runId,\n    });\n\n    if (!snapshot) {\n      throw new Error(`Snapshot not found for run ${this.runId}`);\n    }\n\n    // Parent parallel activeStepsPath can lag behind nested child completion after a crash:\n    // children may already be terminal while the parent still lists them as active and\n    // re-invokes restart(). Treat terminal snapshots as authoritative and reuse them.\n    // See https://github.com/mastra-ai/mastra/issues/20225\n    //\n    // Only statuses already represented on WorkflowResult are reconstructed here.","sourceCodeStart":4691,"sourceCodeEnd":4727,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workflows/workflow.ts#L4691-L4727","documentation":"Thrown by restart() when the run's workflowEngineType is not one of the allowed engines ('default' or 'evented'). restart() — which re-drives a run from its last persisted snapshot after a crash — is only implemented for those engines.","triggerScenarios":"Calling run.restart() on a workflow constructed with a non-default/experimental engine type (e.g. a legacy or custom engine).","commonSituations":"Opting into an experimental workflow engine via config and later calling restart-based recovery code paths written for the default engine; copy-pasting crash-recovery code between projects with different engine settings.","solutions":["Use the default or evented workflow engine for runs you need to restart.","For other engine types, use that engine's own recovery/resume mechanism.","Check how the workflow was constructed (engine type option) before calling restart().","Guard restart() calls behind an engineType check in your recovery code."],"exampleFix":"// before\nawait run.restart();\n// after\nif (run.engineType === 'default' || run.engineType === 'evented') {\n  await run.restart();\n} else {\n  // use engine-specific recovery\n}","handlingStrategy":"validation","validationCode":"if (!['default', 'evented'].includes(run.engineType ?? 'default')) {\n  throw new Error(`restart() unsupported for engine ${run.engineType}`);\n}","typeGuard":"function supportsRestart(engineType: string): boolean {\n  return engineType === 'default' || engineType === 'evented';\n}","tryCatchPattern":"try {\n  await run.restart();\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('restart() is not supported')) {\n    // fall back to engine-specific recovery\n  } else throw e;\n}","preventionTips":["Only use restart() with default/evented engines.","Centralize crash recovery in one utility that checks engine type.","Document engine choice per workflow.","Pin engine configuration so dev/prod match."],"tags":["workflow","restart","engine","unsupported"],"backgroundTag":"unsupported-engine-operation","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}