You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] nanocoder logs buffers the entire log file into memory #1042
The logs() command in the daemon CLI is designed to return the last 64KB of the background daemon log. However, to do this, it calls fs.readFile() on the entire file, pulling hundreds of megabytes into memory just to run .slice(start) on it.
Environment
OS: Any
Node version: Node 18+
Nanocoder version: 1.30.0
Steps to Reproduce
Let the daemon run for a long time until the log file is 1GB.
Run the command to fetch logs.
The Node process will attempt to allocate 1GB of heap memory and crash/stall.
Expected Behavior
The command should stream only the tail end of the file.
Actual Behavior
readFile(logPath, 'utf-8') buffers the whole file into RAM.
Additional Context
I have searched existing issues to ensure this is not a duplicate
I can reproduce this issue consistently
This issue occurs with the latest version of nanocoder
Implementation Notes
Fix in source/daemon/cli.ts:251-253. Use fs.createReadStream(logPath, { start }) or child process tail -c 65536.
Activity
AniketR10 commentedon Aug 30, 2026
@akramcodez please assign me this.
fix(daemon): stream the log tail instead of buffering the whole file (N…