nanocoai/nanoclaw · warning
Failed to write ncl CLI response
Error message
Failed to write ncl CLI response
What it means
The socket server failed to serialize or write a response frame back to the client and the connection could not be closed cleanly. The client will see a hang or EOF instead of a response; the server itself stays healthy.
Source
Thrown at src/cli/socket-server.ts:103
},
});
return;
}
// Host caller — connecting to data/ncl.sock requires file-system access
// to a 0600 socket owned by the host user, so we treat the socket path
// itself as the auth boundary.
const ctx: CallerContext = { caller: 'host' };
const res = await dispatch(req, ctx);
write(conn, res);
}
function write(conn: net.Socket, frame: ResponseFrame): void {
try {
conn.write(JSON.stringify(frame) + '\n');
conn.end();
} catch (err) {
log.warn('Failed to write ncl CLI response', { err });
}
}
function isRequestFrame(x: unknown): x is RequestFrame {
if (!x || typeof x !== 'object') return false;
const o = x as Record<string, unknown>;
return typeof o.id === 'string' && typeof o.command === 'string' && typeof o.args === 'object' && o.args !== null;
}
View on GitHub (pinned to 294ef2aee8)
Solutions
- Retry the ncl command — transient disconnects are the usual cause
- Narrow large queries with `--json` plus explicit ids or list filters
- Check that the client isn't timing out (raise timeout or run on-host)
Defensive patterns
Strategy: retry
Try / catch
try { conn.write(JSON.stringify(frame)+'\n'); conn.end(); } catch { /* client gone; nothing to do */ } Prevention
- Retry ncl commands that hang — usually a dropped connection
- Keep responses small with filters/--json
- Set sane client timeouts so dead connections are reaped
When it happens
Trigger: `conn.write`/`conn.end` throws — client already disconnected (EPIPE), socket destroyed, or the response frame contains a value JSON.stringify chokes on (circular).
Common situations: Client timeout killed the connection before the response arrived; huge response frames on a slow socket.
Related errors
- ncl CLI server connection error
- Failed to chmod ncl socket (continuing)
- Provide --apt <pkg> or --npm <pkg>
- Provide --host <host-path> and --container <container-path>
- messaging group not found: ${id}
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/7dd418f8cc23b7dc.
Report an issue: GitHub.