medusajs/medusa · error · Error

Action "${actionToMove}" could not be found in the following

Error message

Action "${actionToMove}" could not be found in the following steps of "${targetAction}"

What it means

OrchestratorBuilder.move(actionToMove, targetAction) restructures the workflow graph by relocating one action next to another. Before moving, it looks up actionToMove among targetAction's (nested) steps; if no step with that action alias exists there, it throws this error. It usually surfaces indirectly via mergeActions/moveAction/mergeNextAction compositional helpers.

Source

Thrown at packages/core/orchestration/src/transaction/orchestrator-builder.ts:179

      runInParallel,
      mergeNext,
    }: {
      runInParallel?: boolean
      mergeNext?: boolean
    } = {
      runInParallel: false,
      mergeNext: false,
    }
  ): OrchestratorBuilder {
    const parentActionToMoveStep = this.findParentStepByAction(actionToMove)!
    const parentTargetActionStep = this.findParentStepByAction(targetAction)!
    const actionToMoveStep = this.findStepByAction(
      actionToMove,
      parentTargetActionStep
    )!

    if (!actionToMoveStep) {
      throw new Error(
        `Action "${actionToMove}" could not be found in the following steps of "${targetAction}"`
      )
    }

    if (Array.isArray(parentActionToMoveStep.next)) {
      const index = parentActionToMoveStep.next.findIndex(
        (step) => step.action === actionToMove
      )
      if (index > -1) {
        parentActionToMoveStep.next.splice(index, 1)
      }
    } else {
      delete parentActionToMoveStep.next
    }

    if (runInParallel) {
      if (Array.isArray(parentTargetActionStep.next)) {
        parentTargetActionStep.next.push(actionToMoveStep)

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Fix the reference: verify the exact alias string of both actions and that the moved action actually exists under the target's subtree
  2. Rebuild/recompose the workflow so the actions are siblings before merging
  3. If a step was renamed, update all moveTo/mergeActions call sites

Example fix

// before
const step = addToCart.appendTo(prepareCart)
step.moveTo({ destinationAction: "chekout" /* typo */ })

// after
step.moveTo({ destinationAction: "checkout" })
Defensive patterns

Strategy: validation

Validate before calling

const exists = (name) =>
  JSON.stringify(builder.steps).includes(`"action":"${name}"`)
if (!exists(destAction)) throw new Error(`Unknown action ${destAction}`)

Prevention

When it happens

Trigger: Calling .moveTo({ destinationAction }) on a step whose destination action does not (transitively) contain the moved step's alias, or composeActions/mergeActions on names that are not siblings within the target's subtree. Also happens after renaming a step alias but referencing the old name.

Common situations: Renaming or removing a step alias while another compose/move call still references it; typo in an action name in moveTo/mergeActions; referencing a step defined in a different (sub)workflow branch.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/e7973e9d09630273. Report an issue: GitHub.