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
1const helloWorkflow = createWorkflow(2  "hello",3  () => {4    const { data: products } = useQueryGraphStep({5      entity: "product",6      fields: ["id"],7    })8
9    // ✓ No error occurs, the step has a different ID.10    const { data: customers } = useQueryGraphStep({11      entity: "customer",12      fields: ["id"],13    }).config({ name: "fetch-customers" })14  }15)

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 Anything
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