mastra-ai/mastra · error · Error
Not implemented
Error message
Not implemented
What it means
Inside evaluateCondition for the evented step executor, the ExecutionEngine context handed to condition functions stubs bail() as unimplemented — calling it always throws this Error. bail (early-terminating the workflow with a result) is not supported for condition evaluation in the evented engine yet.
Source
Thrown at packages/core/src/workflows/evented/step-executor.ts:474
}): Promise<boolean> {
const callId = randomUUID();
const outputWriter = this.createOutputWriter(runId);
return condition(
createDeprecationProxy(
{
workflowId,
runId,
mastra: this.mastra!,
requestContext,
inputData,
state,
retryCount,
resumeData: resumeData,
getInitData: () => stepResults?.input as any,
getStepResult: getStepResult.bind(this, stepResults),
bail: (_result: any) => {
throw new Error('Not implemented');
},
writer: new ToolStream(
{
prefix: 'workflow-step',
callId,
name: 'condition',
runId,
},
outputWriter,
),
abort: () => {
abortController?.abort();
},
[PUBSUB_SYMBOL]: this.mastra!.pubsub,
[STREAM_FORMAT_SYMBOL]: undefined, // TODO
engine: {},
abortSignal: abortController?.signal,
// TODOView on GitHub (pinned to 75dd419e61)
Solutions
- Remove the bail() call from the condition; return a boolean that controls whether the step runs.
- Use suspend/resume or step output routing to model early termination instead of bail.
- Run the workflow on the standard engine if bail semantics are required.
- Track Mastra releases for evented-engine bail support before relying on it.
Example fix
// before
when: async ({ bail }) => { if (done) bail({ done: true }); return true; }
// after
when: async ({ getStepResult }) => !getStepResult('finish')?.done Defensive patterns
Strategy: validation
Validate before calling
// statically disallow bail in conditions meant for the evented engine
if (conditionFn.toString().includes('bail(')) {
throw new Error('bail() is not supported in evented-engine conditions');
} Try / catch
try { await eventedWf.run({ input }); } catch (e) { if (e.message === 'Not implemented' && usingEventedEngine) { return runOnStandardEngine(input); } throw e; } Prevention
- Never call bail() inside when/condition functions for evented workflows.
- Document engine-specific API support in shared step helpers.
- Add lint/tests that scan condition source for bail usage.
- Track Mastra changelog before using bail on the evented engine.
When it happens
Trigger: A workflow step's when/condition function calls ctx.bail(result) while executing on the evented engine.
Common situations: Reusing condition logic written for the standard engine (where bail works) in an evented workflow; authors using bail to short-circuit a run from a condition.
Related errors
- No Pubsub adapter configured on the Mastra instance
- @mastra/livekit: no workflow specified. Set `workflow` on cr
- create-workflow requires a Mastra context.
- The "workflow-builder" sub-agent is not registered on this M
- create-workflow failed: save-workflow threw ${saveErrors.len
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/9cdc1afac5d10178.
Report an issue: GitHub.