jackwener/OpenCLI · info

Restarting daemon will disconnect ${before.profiles.length}

Error message

Restarting daemon will disconnect ${before.profiles.length} browser profile(s); the extension should reconnect automatically.

What it means

Before restarting the daemon, daemonRestart fetches the current daemon status and warns if connected browser profiles exist, because the restart will sever the WebSocket/native connection between the Browser Bridge extension and the daemon. The message is informational: the extension is expected to reconnect automatically once the new daemon is up. The restart proceeds regardless.

Source

Thrown at src/commands/daemon.ts:77

  const status = await fetchDaemonStatus();
  if (!status) {
    log.info('Daemon is not running.');
    return;
  }

  const ok = await requestDaemonShutdown();
  if (ok) {
    log.success('Daemon stopped.');
  } else {
    log.error('Failed to stop daemon.');
    process.exitCode = 1;
  }
}

export async function daemonRestart(): Promise<void> {
  const before = await fetchDaemonStatus();
  if (before?.profiles && before.profiles.length > 0) {
    log.warn(`Restarting daemon will disconnect ${before.profiles.length} browser profile(s); the extension should reconnect automatically.`);
  }

  const result = await restartDaemon();
  if (!result.stopped) {
    log.error('Failed to stop daemon before restart.');
    process.exitCode = 1;
    return;
  }
  if (!result.status) {
    log.error('Daemon restart timed out before the new daemon reported status.');
    process.exitCode = 1;
    return;
  }

  const action = result.previousStatus ? 'restarted' : 'started';
  const version = formatDaemonVersion(result.status);
  log.success(`Daemon ${action} on port ${result.status.port} (${version}).`);
  if (result.status.extensionConnected) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Proceed — this is expected behavior; the extension reconnects automatically after restart.
  2. Wait a few seconds after restart and rerun your command if it failed during the reconnection window.
  3. If the extension does not reconnect, reload it in chrome://extensions and verify the daemon is running (daemon status).
  4. Schedule restarts for when no browser automations are in flight to avoid interrupted commands.

Example fix

// before: opencli daemon restart with profiles attached -> warning, brief disconnect
// after: finish/stop active browser sessions, then restart, then rerun commands
Defensive patterns

Strategy: retry

Try / catch

await daemonRestart();
await new Promise(r => setTimeout(r, 3000)); // allow extension to reconnect
await retry(() => browserCommand(), { attempts: 3, delayMs: 2000 });

Prevention

When it happens

Trigger: Running the daemon restart command (opencli daemon restart) while one or more browser profiles are attached (before.profiles.length > 0).

Common situations: Daemon upgrade or config change performed while a user's Chrome profile has the extension actively connected; CI machines with long-lived browser sessions being restarted; users surprised that automation commands briefly fail during the restart window.

Related errors


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