“This action cannot be run in the current environment”

For seemingly no reason at all, my favorite shortcut has broken. Nothing changed, but two days ago it just stopped working. And I get the error message “This action cannot be run in the current environment.”

Anyone know what’s going on?

Could be something to do with the way you are triggering something.

Can you share the shortcut and note how you are triggering it (e.g. share sheet, url, tap in app, vebal Siri request).

Hi! I use Launch Center Pro to launch it, cuz I like how it gives me a push notification.

Here’s the iCloud link: https://www.icloud.com/shortcuts/9db7d4fce6bb458d8abe34164f89140d

I’ve tried it with some modification to the note and e-mail addresses and running from LCP. I wasn’t able to reproduce the issue.

Next step is maybe duplicate your shortcut as a backup and then sequentially start removing the actions from the end or start adding in show results from the start so that you can figure out which step is hitting this issue.

Oooh good plan. Will report back.

I have had this too, when returning to shortcut from a pythonista script and then activating ‘Get Clipboard’ action (to get data passed back from Pythonista) - it’s a bug.

A work around appears to be to use a command that returns to focus to the shortcut routine such as quicklook or wait. I inserted a wait 1 second and error message went away.

2 Likes

I had a similar issue when fetching a location, the 1 second delay trick worked for me too.

3 Likes

Oh man!! This worked perfectly! Thanks!

Just had this issue again, googled it came here and saw my own comment. :man_facepalming:

The “wait” command worked for me when it came to mapping where I am.

So how do I had the wait command I am a newbie with shortcuts. I trued to import 4 shortcuts and none of them work they all say the same error code.

There’s an action called “Wait”, just insert that and set the delay you want. If you search in the action list then just drag it into place.

Nice I will have to try this. Hope it works.

So where do you put the wait. First last ?

As I noted to you on Twitter, I believe it would be anywhere before the action that first uses current location. Putting at the start may make sense, but it all depends on the specific shortcut in terms of what is most efficient.

For example, I have a shortcut that asks me if I want weather for home or my current location. I would only need to add a delay before current location processing rather than globally at the start; otherwise I’d be slowing down the home processing unnecessarily, and the whole reason I have home separate is that it is much faster to provide a location than have iOS determine one.

Got to work by adding the delay. Thanks.