jackwener/OpenCLI · warning

[opencli] Tab ${tabId} no longer exists, re-resolving

Error message

[opencli] Tab ${tabId} no longer exists, re-resolving

What it means

A console warning logged when the previously bound tab id can no longer be fetched (chrome.tabs.get rejects) — the tab was closed. If an owned session depended on it, a CommandFailure 'bound_tab_gone' is thrown with remediation advice; otherwise the extension just re-resolves a new tab.

Source

Thrown at extension/src/background.ts:1526

            return { tabId, tab: moved };
          }
        } catch (moveErr) {
          console.warn(`[opencli] Failed to move tab back: ${moveErr}`);
        }
      } else if (!isDebuggableUrl(tab.url)) {
        console.warn(`[opencli] Tab ${tabId} URL is not debuggable (${tab.url}), re-resolving`);
      }
    } catch (err) {
      if (err instanceof CommandFailure) throw err;
      if (existingSession && !existingSession.owned) {
        automationSessions.delete(leaseKey);
        throw new CommandFailure(
          'bound_tab_gone',
          `Bound tab for session "${existingSession.session}" no longer exists.`,
          'Run "opencli browser bind" again, then retry the command.',
        );
      }
      console.warn(`[opencli] Tab ${tabId} no longer exists, re-resolving`);
    }
  }

  const existingPreferredTabId = existingSession?.preferredTabId ?? null;
  if (existingSession && existingPreferredTabId !== null) {
    const session = existingSession;
    try {
      const preferredTab = await chrome.tabs.get(existingPreferredTabId);
      if (isDebuggableUrl(preferredTab.url)) return { tabId: preferredTab.id!, tab: preferredTab };
      if (!session.owned) {
        throw new CommandFailure(
          'bound_tab_not_debuggable',
          `Bound tab for session "${session.session}" is not debuggable (${preferredTab.url ?? 'unknown URL'}).`,
          'Switch the tab to an http(s) page or run "opencli browser bind" on another tab.',
        );
      }
    } catch (err) {
      if (err instanceof CommandFailure) throw err;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run 'opencli browser bind' again on a debuggable http(s) tab, then retry the command
  2. Re-run the failing command — re-resolution will pick or create a replacement tab
  3. Keep the automation window/tab open while commands are running
  4. Use a dedicated browser window for automation to avoid accidental closure
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = await chrome.tabs.get(tabId).then(() => true).catch(() => false);
if (!exists) await opencliBrowserBind();

Try / catch

try { await runBoundCommand(); } catch (e) { if (e.code === 'bound_tab_gone') { await bind(); await runBoundCommand(); } else throw e; }

Prevention

When it happens

Trigger: User (or a script) closes the bound tab between commands; a window containing the tab is closed; Chrome crashes and restores without the tab.

Common situations: Manual cleanup of browser tabs during long automation sessions; closing windows at end of day; tab crash ('Aw, Snap') removing the tab.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/330dca9e6d62f031. Report an issue: GitHub.