Error opening workspace: Internal error encountered

Is anyone else experiencing this on a FREQUENT basis? I have to restart my environment perhaps once every fifteen minutes since it hangs. When I refresh it is in this state, and I have to restart the VM.

I estimate I’m loosing perhaps 25% of my time.

Are you talking about the internal error on the preview? Its a little black screen with “Internal Error Occurred” in white text in the upper left hand corner?

If so this is typically a .next cache issue.

Instruct the AI to clear the cache

Please clear the .next cache

Then you can click the arrow next to the refresh button in the preview window and do a hard restart. This is the same as triggering a npm run dev.

You can even take is a step further and delete both the .next file (your apps build) and the node-modules (dependencies) folders

Then do a

  1. npm install - This reinstalls your dependencies
  2. npm run dev or hard restart the preview <— recommended as its easy.

Then it should clear the internal issue you are describing all without restarting the dev environment.

If you have any further questions I will try to assist the best I can. I am not by any means an expert but i know enough to be dangerous. :slight_smile:

Also rereading this, yes i know what you are talking about.

There are issues with the content re-rendering of the app as you are updating a file. My recommendation would be to kill the preview window and in the terminal killing the dev run process by pressing control + c.

it can also happen when you have a onsnap listener that is not being closed properly, what will happen with every re-render of the page while editing, if the previous onsnap listener is not close you now will have 2, then 3, then 4, then 5 after every edit causing a memory leak and infinite loops.

If you are using onsnap listeners, ask your ai to search “grep” your app folder (src) for onsnap and then ask it to analyze the onsnap to ensure it is properly closed when no longer needed or page change etc.

something like

const unsubscribe = onSnapshot(docRef, (doc) => {
console.log("Current data: ", doc.data());
});

if that unsubscribe is not being used, you are going to ahve a bad time with memory leaks and that will crash your dev environment which has far less resources than your app hosting will, but even app hosting will eventually crash not to mention the extra cpu costs involved when you peak at the memory limit.