Skip to main content

Fixing Zaps with step dependencies ("This step didn‘t run because it depended on a previous step")

  • 6 June 2024
  • 0 replies
  • 50 views

You might have come across this before, or you're checking out this post because of the following error message:

"This XYZ step didn’t run because it relied on an earlier step or filter that didn’t work."

Here’s what it looks like:

Step dependency error

Why is this happening?

Well, an action step often depends on a field from a previous step (see also field mapping). If that previous step fails, the dependent action step gets skipped because it needed information from the failed step. This is usually helpful, as it prevents errors.

If this happened due to a Filter by Zapier step, it means the conditions weren’t met. You can find more information about Filter by Zapier here.

But what if I want to continue anyway?

There’s a trick for that, and I’m going to show you how.

First, note that this is generally helpful if a specific action step is also mapped with fields from other steps. In the example below, I use a GET request to get a formatted address from the Google Maps API, and then a Formatter > Number > Math Operation step to calculate a number. This data goes into a Zapier Table.

How to resolve it?

The obvious answer is to use the Formatter > Text > Default Value step. However, if the key is never sent, that step will be skipped too. Instead, we’ll use some AI and a Run Python in Code by Zapier step.

Here’s a summary of the step to take:

  • Add a Run Python in Code by Zapier step
  • Use the Generate with AI button, add the prompt
  • Map the output of this step in the action step

Add a Code step

Use Generate with AI to have the code created for you!

As an example, I have added 2 keys: “address” and “key”. You can do this for as many fields as you’d like to return a blank value for.

Add a prompt

Change the number of input variables and the names of the keys where needed.

The code it generated for me:

# Check if the 'address' key exists in the input_data dictionary
if "address" in input_data:
# If it exists, assign the value to the 'address' variable
address = input_data "address"]
else:
# If it doesn't exist, assign None to the 'address' variable
address = None

# Check if the 'key' key exists in the input_data dictionary
if "key" in input_data:
# If it exists, assign the value to the 'key' variable
key = input_datae"key"]
else:
# If it doesn't exist, assign None to the 'key' variable
key = None

# Create a dictionary with 'address' and 'key' as keys and their respective values
output = {"address": address, "key": key}

Make sure to test the step!

And then...

Mapping the output

Select the output from the Code by Zapier step.

Finally, we can map the output from the Code by Zapier step. Even if the key-value pair doesn’t exist, a blank or null value will be returned, allowing the dependent action step to continue. Here’s a screenshot of how it looks in a Zap run:

Now, the dependant action step was not skipped.

There we go! Using a nifty workaround, we can work around the dependancy limitation and still get an action step to run as intended.

Final tip: adjust the AI prompt to return a fallback value like “n/a”, instead of a blank/null value, in case you still want to send some kind of data. This can be helpful in case a field in a dependant action step is set to required. An example of this is when a Last Name is required, but you only have a first name. 

I hope this helps!

All the best,

~ Leo

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.