Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: retry on No window with id CDP error#892

Merged
jackwener merged 2 commits into
jackwener:mainfrom
elias-didoo:fix-window-id-retry-v2
Apr 8, 2026
Merged

fix: retry on No window with id CDP error#892
jackwener merged 2 commits into
jackwener:mainfrom
elias-didoo:fix-window-id-retry-v2

Conversation

@elias-didoo
Copy link
Copy Markdown
Contributor

Fixes two issues that cause Twitter and browser commands to fail with 'No window with id' after Chrome restart or window close.

Root Cause

  1. Missing transient patternsrc/browser/errors.ts TRANSIENT_ERROR_PATTERNS did not include 'No window with id', so the daemon-client retry logic skipped these errors and failed immediately.

  2. Early break in extension retry loop — In extension/src/cdp.ts, when chrome.tabs.get() throws (tab/window is gone), the retry loop breaked immediately instead of continuing to retry. This prevented the retry mechanism from creating a fresh window.

Changes

src/browser/errors.ts

const TRANSIENT_ERROR_PATTERNS = [
  'Extension disconnected',
  'Extension not connected',
  'attach failed',
  'no longer exists',
  'CDP connection',
  'Daemon command failed',
+ 'No window with id',
] as const;

extension/src/cdp.ts

        } catch {
-         lastError = `Tab ${tabId} no longer exists`;
-         break;
+         // Tab is gone — the window it belonged to was closed.
+         // Do NOT break; let the retry loop create a fresh window/tab.
+         lastError = `Tab ${tabId} no longer exists`;
+         // Don't break; fall through to retry
        }

Impact

  • Twitter commands (search, timeline, etc.) will now auto-recover after Chrome restart
  • Browser commands in general will be more resilient to window/tab lifecycle events
  • Hackernews and other non-browser commands are unaffected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants