Random "no file to import" errors when nothing has changed

I’ve written a Scriptable widget for my iPhone homescreen. 95% of the time, it works perfectly. But every now and then, with no source code changes, it randomly shows an error about no longer being able to find a file:

image

And it’s true, suddenly my dates.js file no longer exists in the script list within Scriptable! Why did it randomly disappear? It’s stored in the same place as the script that’s trying to import it. Why can it continue to find one file but not the other?

This has happened to me a handful of times in the past. It eventually resolves itself (sometimes after hours, sometimes after days or weeks), again with me making no changes to anything.

What’s going on? How can I fix it without having to wait days (or weeks!) for it to “fix” itself?

iCloud automatically offloading it perhaps and then syncing it back?

Try setting it to stay downloaded (never offload).

2 Likes

Thanks for the quick reply! You’re right, it’s an iCloud problem. I couldn’t open or sync the file even on my laptop, although I could see it there.

From a Reddit thread, I followed the suggestion to touch the file via the command line to force it to re-upload. And voilà, it started working again!

Unfortunately, I won’t be able to run the latest version of iOS with the new “keep downloaded” feature. But at least now I know what manual steps I can do next time this randomly happens.

1 Like

Is there a way to store the Scriptable files locally, instead of using iCloud?

Yes. Just put it in your local folder (“On My iPhone” root). Check out the order of precedence on the importModule function.

1 Like