Automation script sometimes throws a non-helpful error that I can't track

I created an automation script and it always works… but sometimes without any reason it throw a non helpful error that I can’t track.

“Run a script” shows “Step failed.”
and execution log shows:
“There was an unexpected error while executing your script.”

image

Is there anyway to track this error?

You say that the script always works but sometimes throws an error. Does that mean that the script works, even when it throws the error?

I’m afraid that you cannot debug the script from only the information in your screen capture.

The first step in debugging these issues is to identify the specific record that is causing problems and see how it is different from all of the other records that do not cause the error.

It is also possible that the automation script failed due to the same problem on Airtable’s end yesterday that caused scripting app scripts to fail.

1 Like

Yes, that’s what I did but I couldn’t figure exactly the reason and it didn’t happen again until now. But I am curious to see the error log with a helpful error message instead of this non-helpful message to prevent future errors

If course all devs would like to get helpful error messages. But we don’t always get them. So we must try to work with what info we do get.

Airtable tries to provide helpful error messages when it can. Sometimes it can’t. Plus, sometimes a vague error message is better than an incorrect error message that can lead one down incorrect rabbit trails. (For example, whenever a fetch doesn’t work, Airtable suggests cors errors, even when cors is not the issue.)

The best way to get better error messages in the future is to contact Airtable support with your issue and hope Airtable’s engineers can reproduce your issue and debug it. As this is a community forum, there is no guarantee that an Airtable employee will see your post here.

1 Like

I have hit this error when pressing the “test” button on a script that runs on record creation, and uses an input variable that’s an array value. I think the system is choking on the fact that the input variable is null, so when it does array.IDs to build the input for my script, it throws an internal null ref.

I’m not able to repro 100% of the time – it’s as if the system is sometimes providing dummy input for all input variables, and sometimes not. But a better error message would really help one way or another.

The difficulty in debugging automation scrips is one reason why I usually write my scrips in scripting app and run them from a button field. That way I can control the input record and use output.inspect for debugging. After I feel the script is solid, I convert it to an action script by converting the script settings to automation input variables and a few other minor changes.