← Back to Kontasks
Root Cause: Console Reconnecting Loop Bug
Analysis of why konui/konsole needed restart after telemetry kontask
Output
Root Cause Analysis: Console Stuck in RECONNECTING
Two JavaScript bugs caused the console to get stuck in a polling/reconnecting loop
Bug #1: Undefined todos in state machine
// console-sm-transitions.ts:94-95
case "todo_update": {
const todos = event.todos; // ← Could be undefined!
const completed = todos.filter(...) // ← CRASH
}Error: TypeError: can't access property "filter", todos is undefined
Bug #2: Undefined string in history logging
// console-history.ts:190
log('debug', 'history', 'Kontask output', {
startsWithHtml: (outputHtml && outputHtml.trim()).startsWith('<')
// ↑ Returns undefined if falsy, then .startsWith() crashes
});Error: TypeError: can't access property "startsWith" of undefined
Fixes Applied
| File | Fix |
|---|---|
| console-sm-transitions.ts | Added null guard before filtering todos |
| console-recovery.ts | Fixed dispatch format to match handler |
| console-history.ts | Fixed logging to handle undefined outputHtml |
What Triggered It
The telemetry-dashboard script sent multiple prompts through konui. When the console tried to poll for progress on kontasks that had no todos array in their context, the JavaScript crashed. This prevented proper state transitions, leaving the console stuck in "RECONNECTING..." mode.
✓ konui has been restarted with the fixes
What's Next?
Choose an action:
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
consolebug-fixstability
Created
3 Jan 2026, 6:35 pm
Updated
3 Jan 2026, 6:35 pm
Created By
claude
Raw Data
{
"id": "72ff9139-15cc-4d4f-be1a-df73bc3d7b8d",
"type": "general",
"status": "completed",
"title": "Root Cause: Console Reconnecting Loop Bug",
"description": "Analysis of why konui/konsole needed restart after telemetry kontask",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:'Consolas','Monaco',monospace;\"><h2 style=\"font-family:sans-serif;color:#fff;margin:0 0 16px 0;\">Root Cause Analysis: Console Stuck in RECONNECTING</h2><p style=\"color:#9ca3af;margin:0 0 16px 0;\">Two JavaScript bugs caused the console to get stuck in a polling/reconnecting loop</p><h3 style=\"color:#e06c75;margin:16px 0 8px 0;\">Bug #1: Undefined todos in state machine</h3><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><pre style=\"margin:0;font-size:0.85rem;color:#e0e0e0;\">// console-sm-transitions.ts:94-95\ncase \"todo_update\": {\n const todos = event.todos; // ← Could be undefined!\n const completed = todos.filter(...) // ← CRASH\n}</pre><p style=\"color:#9ca3af;margin:12px 0 0 0;\"><strong>Error:</strong> <code style=\"color:#e06c75;\">TypeError: can't access property \"filter\", todos is undefined</code></p></div><h3 style=\"color:#e06c75;margin:16px 0 8px 0;\">Bug #2: Undefined string in history logging</h3><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><pre style=\"margin:0;font-size:0.85rem;color:#e0e0e0;\">// console-history.ts:190\nlog('debug', 'history', 'Kontask output', { \n startsWithHtml: (outputHtml && outputHtml.trim()).startsWith('<')\n // ↑ Returns undefined if falsy, then .startsWith() crashes\n});</pre><p style=\"color:#9ca3af;margin:12px 0 0 0;\"><strong>Error:</strong> <code style=\"color:#e06c75;\">TypeError: can't access property \"startsWith\" of undefined</code></p></div><h3 style=\"color:#98c379;margin:16px 0 8px 0;\">Fixes Applied</h3><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><table style=\"width:100%;border-collapse:collapse;\"><tr style=\"border-bottom:1px solid #444;\"><th style=\"text-align:left;padding:8px;color:#98c379;\">File</th><th style=\"text-align:left;padding:8px;color:#98c379;\">Fix</th></tr><tr><td style=\"padding:8px;color:#61afef;\">console-sm-transitions.ts</td><td style=\"padding:8px;\">Added null guard before filtering todos</td></tr><tr><td style=\"padding:8px;color:#61afef;\">console-recovery.ts</td><td style=\"padding:8px;\">Fixed dispatch format to match handler</td></tr><tr><td style=\"padding:8px;color:#61afef;\">console-history.ts</td><td style=\"padding:8px;\">Fixed logging to handle undefined outputHtml</td></tr></table></div><h3 style=\"color:#61afef;margin:16px 0 8px 0;\">What Triggered It</h3><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\"><p style=\"margin:0;line-height:1.6;\">The telemetry-dashboard script sent multiple prompts through konui. When the console tried to poll for progress on kontasks that had no todos array in their context, the JavaScript crashed. This prevented proper state transitions, leaving the console stuck in \"RECONNECTING...\" mode.</p><p style=\"margin:12px 0 0 0;color:#98c379;\">✓ konui has been restarted with the fixes</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-top:16px;\"><h4 style=\"margin:0 0 8px 0;color:#fff;\">What's Next?</h4><p style=\"color:#9ca3af;margin:0;\">Choose an action:</p></div></div>",
"choices": [
{
"label": "Test console",
"value": "Send a test prompt to verify the console is working correctly after the bug fix",
"primary": true
},
{
"label": "View logs",
"value": "Show the latest konui logs to verify no more JavaScript errors"
},
{
"label": "Run more telemetry",
"value": "Run the telemetry-dashboard script again to verify it no longer crashes the console"
}
],
"requestedAt": "2026-01-03T18:33:00.000Z",
"requestId": "333b71eb-536e-4c3f-b208-8742c26c50fb"
},
"createdBy": "claude",
"createdAt": "2026-01-03T08:35:31.564Z",
"updatedAt": "2026-01-03T08:35:31.946Z",
"requestId": "333b71eb-536e-4c3f-b208-8742c26c50fb",
"scope": "vibetools",
"tags": [
"console",
"bug-fix",
"stability"
],
"targetUser": "claude"
}