ruvnet/ruflo · error
String(err instanceof Error ? err.message : err)
Error message
String(err instanceof Error ? err.message : err)
What it means
Diagnostic in startLocalLLMProxy: expression that normalizes a caught upstream/proxy error into its message string (err.message when Error, otherwise the value itself) so the proxy can log or return the failure reason for a proxied browser-intent LLM request.
Source
Thrown at v3/@claude-flow/cli/src/mcp-tools/browser-intent-tools.ts:247
method: req.method,
headers: {
'content-type': 'application/json',
// The real key is injected here, server-side, and nowhere else —
// whatever Authorization header the page-context request carried
// (the placeholder) is discarded.
authorization: `Bearer ${real.apiKey}`,
},
body: body.length > 0 ? body : undefined,
})
.then(async (upstream) => {
const text = await upstream.text();
res.writeHead(upstream.status, {
'content-type': upstream.headers.get('content-type') || 'application/json',
});
res.end(text);
})
.catch((err: unknown) => {
res.writeHead(502, { 'content-type': 'application/json' });
res.end(JSON.stringify({ error: { message: String(err instanceof Error ? err.message : err) } }));
});
});
});
server.on('error', reject);
server.listen(0, '127.0.0.1', () => {
const addr = server.address();
const port = typeof addr === 'object' && addr ? addr.port : 0;
resolve({
url: `http://127.0.0.1:${port}`,
close: () => {
try { server.close(); } catch { /* best-effort */ }
},
});
});
});
}
View on GitHub (pinned to fa13ee4ad6)
Solutions
- Propagate the real underlying error message instead of a placeholder; log the full stack for diagnosis.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at v3/@claude-flow/cli/src/mcp-tools/browser-intent-tools.ts:247 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/31737e0604ca4805.
Report an issue: GitHub.