Skip to content

[Critical] Application Freezes/Crashes during Next.js Code Generation (WebContainer/ActionRunner) #59

@trahoangdev

Description

@trahoangdev

What happened?

I am reporting a critical stability issue where the application becomes unresponsive or completely crashes while the AI is generating code for a project.

Specifically, I used the Next.js starter template (cloned from your repo). The initial structure scaffolding works fine. However, when I prompt the AI to implement features (causing it to generate/write to multiple files), the process hangs halfway through.

  • The UI stops updating.
  • The browser tab may become unresponsive or crash ("Aw, Snap!" error).
  • The terminal output in the browser stops streaming.

How to reproduce

  1. Open the application (CodinIT) in a browser.
  2. Start a new project (or chat) using the Next.js template/stack.
  3. Wait for the initial npm install and startup (Success).
  4. Enter a complex prompt that requires modifying multiple files (e.g., "Create a dashboard with sidebar and 3 charts").
  5. Observe the generation process.

Observed Behavior

The AI begins writing code. After modifying 2-3 files (or partway through a large file), the application freezes. The cursor stops moving, the "Stop" button becomes unclickable, and eventually, the browser page may crash due to high memory usage or a thread deadlock.

Expected Behavior

The AI should complete the code generation for all requested files without freezing the UI, and the WebContainer usually should handle file writes asynchronously without blocking the main thread.

Environment

OS: Windows (This is critical as WebContainers have known file system issues on Windows).
Browser: Chrome / Edge.
Project Stack: Next.js (Node.js environment).
Repo: Standard CodinIT Next.js Template

Extra info

Potential Causes (Analysis)

  • WebContainer Memory Limit: Next.js dev server is memory-intensive. Running both the Dev Server and the AI generation logic simultaneously might be exceeding the browser tab's memory limit (OOM).
  • ActionRunner/Queue Deadlock: The ActionRunner (responsible for executing file writes) might be getting stuck if the AI streams data faster than the file system can acknowledge, especially on Windows file handles.
  • Large Artifact Handling: If the AI returns a very large single artifact, the message-parser might be blocking the main thread.

Possible Logs / Errors

(Check Browser Console - F12)

  • Error: Out of memory
  • Uncaught (in promise) Error: File system locked
  • [WebContainer] Process exited with code 137 (OOM signal)

Metadata

Metadata

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions