Step X is already defined in workflow Error

If you get the following error when you start the Medusa application:

Terminal
Error: Step X is already defined in workflow.

Where X is any step, such as create-remote-link.

Why this Error Occurred#

This error indicates that you're re-using a step in a workflow, meaning that more than one step in the workflow have the same name.


How to Fix it#

To resolve this error, use the config method of a step to specify a custom name within the workflow's scope. For example:

Code
const helloWorkflow = createWorkflow(
  "hello",
  () => {
    const { data: products } = useQueryGraphStep({
      entity: "product",
      fields: ["id"],
    })

    // ✓ No error occurs, the step has a different ID.
    const { data: customers } = useQueryGraphStep({
      entity: "customer",
      fields: ["id"],
    }).config({ name: "fetch-customers" })
  }
)

In the above example, you use the config method on the second useQueryGraphStep usage to change its name to fetch-customers.

Make sure to change the name of every usage after the first one in a workflow.


Additional Resources#

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵