mastra-ai/mastra · error

InProcessStrategy: could not resolve step "${params.stepId}"

Error message

InProcessStrategy: could not resolve step "${params.stepId}" at executionPath [${params.executionPath.join(',')}] in workflow "${params.workflowId}"

What it means

InProcessStrategy executes workflow steps inside the same process as Mastra. Before executing, it resolves the workflow by ID via mastra.getWorkflowById() and walks the executionPath to find the step's run entry. This error means that lookup returned nothing: either the workflow ID doesn't exist or the executionPath/stepId doesn't match a step registered in the workflow.

Source

Thrown at packages/core/src/worker/strategies/in-process-strategy.ts:34

    this.#mastra = mastra;
  }

  __registerMastra(mastra: Mastra): void {
    this.#mastra = mastra;
  }

  async executeStep(params: StepExecutionParams): Promise<StepResult<any, any, any, any>> {
    if (!this.#mastra) {
      throw new Error('InProcessStrategy requires Mastra instance. Call __registerMastra() first.');
    }

    // Use getWorkflowById — events carry the workflow's `id` property
    // (e.g. "scheduled-workflow"), not the config key ("scheduledWorkflow").
    const workflow = this.#mastra.getWorkflowById(params.workflowId);
    const entry = getStepEntry(workflow, params.executionPath);

    if (!entry) {
      throw new Error(
        `InProcessStrategy: could not resolve step "${params.stepId}" at executionPath [${params.executionPath.join(',')}] in workflow "${params.workflowId}"`,
      );
    }

    const rc = new RequestContext<unknown>(Object.entries(params.requestContext ?? {}));

    let abortController: AbortController | undefined;
    if (params.abortSignal) {
      abortController = new AbortController();
      if (params.abortSignal.aborted) {
        abortController.abort(params.abortSignal.reason);
      } else {
        params.abortSignal.addEventListener(
          'abort',
          () => {
            abortController!.abort(params.abortSignal!.reason);
          },
          { once: true },

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Verify the workflowId matches the workflow instance's `id` property, not the Mastra config key — use getWorkflowById semantics
  2. Print mastra.getSteps()/workflow definition and confirm the stepId exists in that workflow
  3. Check the executionPath: it must point to a live nested step run; re-fetch the run's executionPath via workflow runs API instead of reusing a stale one
  4. If the workflow lives in another process/service, switch to the remote/HTTP step execution strategy instead of InProcessStrategy

Example fix

// before
await strategy.executeStep({ workflowId: 'scheduledWorkflow', stepId: 'sendEmail', executionPath: ['0'] });
// after
const wf = mastra.getWorkflowById('scheduled-workflow'); // use the workflow's id, not the config key
await strategy.executeStep({ workflowId: wf.id, stepId: 'sendEmail', executionPath: currentRun.executionPath });
Defensive patterns

Strategy: validation

Validate before calling

const wf = mastra.getWorkflowById(workflowId);
if (!wf) throw new Error(`Unknown workflow: ${workflowId}`);
const step = wf.getStep(stepId);
if (!step) throw new Error(`Workflow ${workflowId} has no step ${stepId}`);

Type guard

function isRegisteredWorkflow(mastra, id) { return typeof mastra.getWorkflowById(id) !== 'undefined'; }

Try / catch

try {
  await strategy.executeStep(params);
} catch (e) {
  if (String(e.message).startsWith('InProcessStrategy: could not resolve step')) {
    logger.error('step/workflow resolution failed', { workflowId: params.workflowId, stepId: params.stepId, executionPath: params.executionPath });
  } else throw e;
}

Prevention

When it happens

Trigger: Calling executeStep with a workflowId that was never registered (or registered under a different config key), a stepId that is not part of the workflow's steps, or an executionPath array that doesn't correspond to an active/valid nested run path (e.g. referencing a nested step after the run finished or before it started).

Common situations: Using the Mastra config key ('scheduledWorkflow') instead of the workflow instance's id ('scheduled-workflow'); renaming or removing a step without updating the caller; passing a stale executionPath captured from an earlier run; typos in step IDs.

Related errors


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