{"record":{"id":"17511c4f0d921d81","repo":"mastra-ai/mastra","slug":"no-pubsub-adapter-configured-on-the-mastra-instanc","errorCode":null,"errorMessage":"No Pubsub adapter configured on the Mastra instance","messagePattern":"No Pubsub adapter configured on the Mastra instance","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/workflows/evented/execution-engine.ts","lineNumber":93,"sourceCode":"      forEachIndex?: number;\n    };\n    pubsub?: PubSub; // Not used - evented engine uses this.mastra.pubsub directly\n    requestContext: RequestContext;\n    retryConfig?: {\n      attempts?: number;\n      delay?: number;\n    };\n    abortController: AbortController;\n    format?: 'legacy' | 'vnext' | undefined;\n    outputOptions?: {\n      includeState?: boolean;\n      includeResumeLabels?: boolean;\n    };\n    perStep?: boolean;\n  }): Promise<TOutput> {\n    const pubsub = this.mastra?.pubsub;\n    if (!pubsub) {\n      throw new Error('No Pubsub adapter configured on the Mastra instance');\n    }\n\n    // Set up promise that will resolve when workflow finishes\n    // CRITICAL: Must subscribe BEFORE publishing events to avoid race condition\n    let resolveResult!: (data: any) => void;\n    let rejectResult!: (error: any) => void;\n    const resultPromise = new Promise<any>((resolve, reject) => {\n      resolveResult = resolve;\n      rejectResult = reject;\n    });\n\n    const finishCb = async (event: Event, ack?: () => Promise<void>) => {\n      if (event.runId !== params.runId) {\n        await ack?.();\n        return;\n      }\n\n      if (['workflow.end', 'workflow.fail', 'workflow.suspend'].includes(event.type)) {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workflows/evented/execution-engine.ts#L75-L111","documentation":"The evented workflow execution engine's execute() method requires a Pub/Sub adapter to publish step events and subscribe for results. If mastra.pubsub is undefined, it throws immediately before doing any work, because the evented path cannot function without it.","triggerScenarios":"Calling the evented execution engine's execute() (evented workflow run) on a Mastra instance that was constructed without a pubsub adapter, or where this.mastra is undefined.","commonSituations":"Switching a workflow to the evented engine without adding MastraOptions.pubsub; using a Mastra instance created in a different module than the one configured; forgetting to migrate configuration when opting into evented workflows.","solutions":["Configure a pubsub adapter on Mastra: new Mastra({ pubsub: myPubsubAdapter, ... }).","Verify you are executing against the same configured Mastra instance (this.mastra is set).","If you don't need evented execution, use the standard (non-evented) workflow run path instead."],"exampleFix":"// before\nconst mastra = new Mastra({ agents: {...} });\nawait eventedEngine.execute(...); // throws\n// after\nconst mastra = new Mastra({ agents: {...}, pubsub: new InMemoryPubSubAdapter() });","handlingStrategy":"validation","validationCode":"if (!mastra?.pubsub) {\n  throw new Error('Evented workflow execution requires a pubsub adapter; configure Mastra({ pubsub: ... })');\n}","typeGuard":"function supportsEventedExecution(mastra: Mastra | undefined): mastra is Mastra & { pubsub: NonNullable<Mastra['pubsub']> } {\n  return !!mastra?.pubsub;\n}","tryCatchPattern":"try { await eventedEngine.execute(...); } catch (e) { if (e.message === 'No Pubsub adapter configured on the Mastra instance') { return runStandardEngine(input); } throw e; }","preventionTips":["Add a pubsub adapter to Mastra config before enabling evented workflows.","Use a single shared Mastra factory so all engine paths see the same configuration.","Feature-flag evented execution and gate on pubsub presence.","Write an integration test that asserts evented execute() boots cleanly."],"tags":["workflows","evented","pubsub","configuration"],"backgroundTag":"missing-adapter-configuration","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}