CLI dev processes crash with ENOENT error very often since dev platform migration

The CLI processes just crash randomly with the error ENOENT as you can see at the bottom of the logs in the screenshot:

Also even while the CLI processes are running I see a lot of ENOENT error logs whenever I save a typescript file in my theme app extension (it’s a svelte app bundled with Vite, which spits out the output js files to the /assets folder directly).
The only way I managed to be able to make some development without all dev processes crashing was by cloning and building the CLI from local source with this code commented out (supportsDevSessions is true in my case, which I believe is where the issues mostly happen):

The CLI seems to have quite a bit of trouble with file watching and properly handling many file asset changes in quick succession (vite is configured to remove the output files before writing them again).

You can see a memory leak warning as well:

2 Likes

Hi @Zak

Yes this seems likely to be a race condition with file changes in the asset folder and our bundler. Can you provide a minimal code sample and vite config that reproduces the issue?

Otherwise, can you alter your build setup to reduce changes to the folder that the CLI is watching? It’s designed for hand-altered files. We could be more defensive here but the workaround in the meantime might be to build your svetlte to a different path, then copy.

-Nick

Thanks for the reply, Nick!

I have tried outputting to a different path and then copying the files, but the same issue happened.

The race conditions have always been there I believe, the problem is just that since we were automatically migrated to the new dev platform, the CLI started crashing when files were not found due to the race conditions.

So ideally, it would be enough to just save the processes from crashing when the CLI encounters those ENOENT errors and just log something instead of exiting altogether.
Also the event emitter leak (as shown in the screenshot) could be exacerbating the race conditions, so that could also be a small improvement that could help.

I will try to put together a very simple repo to reproduce the issue and I’ll ping you.

The same issue with the same stack (Vite + Svelte) here. I use Vite constantly build a new js for TAE when changes are detected. This issue breaks the dev mode when I make a slight change.

Hey folks - are you still seeing this issue?

Hey Liam, yes, it’s still happening on the latest version of the CLI :confused: