{"record":{"id":"b20856a867d99bb1","repo":"mastra-ai/mastra","slug":"uncommitted-step-flow-changes-detected-call-comm","errorCode":null,"errorMessage":"Uncommitted step flow changes detected. Call .commit() to register the steps.","messagePattern":"Uncommitted step flow changes detected\\. Call \\.commit\\(\\) to register the steps\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/workflows/evented/workflow.ts","lineNumber":1728,"sourceCode":"  }\n\n  __registerMastra(mastra: Mastra) {\n    super.__registerMastra(mastra);\n    this.executionEngine.__registerMastra(mastra);\n  }\n\n  async createRun(options?: {\n    runId?: string;\n    resourceId?: string;\n    disableScorers?: boolean;\n  }): Promise<Run<TEngineType, TSteps, TState, TInput, TOutput>> {\n    if (this.stepFlow.length === 0) {\n      throw new Error(\n        'Execution flow of workflow is not defined. Add steps to the workflow via .then(), .branch(), etc.',\n      );\n    }\n    if (!this.executionGraph.steps) {\n      throw new Error('Uncommitted step flow changes detected. Call .commit() to register the steps.');\n    }\n\n    const runIdToUse = options?.runId || randomUUID();\n\n    const workflowsStore = await this.mastra?.getStorage()?.getStore('workflows');\n\n    const supportsConcurrentUpdates = workflowsStore?.supportsConcurrentUpdates?.() ?? false;\n    if (workflowsStore && !supportsConcurrentUpdates) {\n      throw new MastraError({\n        id: 'ATOMIC_STORAGE_OPERATIONS_NOT_SUPPORTED',\n        domain: ErrorDomain.MASTRA,\n        category: ErrorCategory.USER,\n        text:\n          `Workflow \"${this.id}\" runs on the evented execution engine, which requires a storage adapter that supports concurrent updates. ` +\n          `Your current workflow storage adapter does not. Switch to an adapter that does (for example @mastra/libsql), or, if you do not need scheduled execution, ` +\n          `remove the \\`schedule\\` field from this workflow's definition to use the default execution engine.`,\n        details: { workflowId: this.id },\n      });","sourceCodeStart":1710,"sourceCodeEnd":1746,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workflows/evented/workflow.ts#L1710-L1746","documentation":"`createRun()` found steps defined in `stepFlow` but `this.executionGraph.steps` is unset, meaning `.commit()` was never called after the flow was built. Committing compiles the chained steps into the execution graph the runner executes; without it the graph is stale or empty. The error instructs the developer to call `.commit()` to register the steps.","triggerScenarios":"Calling `createRun()`/`start()` after chaining steps (`.then()`, `.branch()`, ...) but before calling `.commit()`; or adding new steps to an already-committed workflow and re-running without re-committing (workflow.ts:1727-1730).","commonSituations":"Forgetting the `.commit()` terminal call when writing the workflow definition; conditionally appending steps at runtime and skipping commit; upgrading from older mastra versions where commit was implicit.","solutions":["Call `.commit()` after all step chaining, immediately before creating runs.","If steps are added dynamically, call `.commit()` again after the modifications and before the next run.","Centralize workflow construction in a factory that always ends with `.commit()` so it cannot be forgotten."],"exampleFix":"// before\nconst wf = new Workflow({ id: 'pipeline', mastra });\nwf.then(stepA).then(stepB);\nawait wf.start({ inputData }); // throws: uncommitted\n\n// after\nconst wf = new Workflow({ id: 'pipeline', mastra });\nwf.then(stepA).then(stepB).commit();\nawait wf.start({ inputData });","handlingStrategy":"validation","validationCode":"function assertCommitted(wf: Workflow): void {\n  if ((wf as any).stepFlow?.length > 0 && !(wf as any).executionGraph?.steps) {\n    throw new Error('Workflow steps defined but not committed; call .commit() before createRun()');\n  }\n}\nassertCommitted(workflow);","typeGuard":"function isCommitted(w: Workflow): boolean {\n  return !!(w as any).executionGraph?.steps;\n}","tryCatchPattern":"try {\n  const run = workflow.createRun();\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Uncommitted step flow changes')) {\n    workflow.commit(); // then retry once\n    return workflow.createRun();\n  } else throw e;\n}","preventionTips":["Make `.commit()` the last line of every workflow definition.","Re-commit after any runtime modification of steps.","Grep for `.then(` on workflow instances and confirm a matching `.commit()` exists."],"tags":["workflow","configuration","commit","lifecycle"],"backgroundTag":"uncommitted-workflow-changes","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}