google-gemini/gemini-cli · error · Error

Browser agent requires user consent to proceed. Please re-ru

Error message

Browser agent requires user consent to proceed. Please re-run and accept the privacy notice.

What it means

Thrown by connectWithRetry when getBrowserConsentIfNeeded() resolves false. Consent is requested on first run per profile (sentinel file browser-consent-acknowledged.txt missing) and only in interactive mode (a CoreEvent.ConsentRequest listener is attached); false means the user actively declined the privacy notice.

Source

Thrown at packages/core/src/agents/browser/browserManager.ts:489

      this.disconnected = false;
    }

    // Start connecting; store the promise so concurrent callers can join it
    this.connectionPromise = this.connectWithRetry().finally(() => {
      this.connectionPromise = undefined;
    });

    return this.connectionPromise;
  }

  /**
   * Connects to chrome-devtools-mcp with exponential backoff retry.
   */
  private async connectWithRetry(): Promise<void> {
    // Request browser consent if needed (first-run privacy notice)
    const consentGranted = await getBrowserConsentIfNeeded();
    if (!consentGranted) {
      throw new Error(
        'Browser agent requires user consent to proceed. ' +
          'Please re-run and accept the privacy notice.',
      );
    }

    let lastError: Error | undefined;
    for (let attempt = 0; attempt < MAX_RECONNECT_RETRIES; attempt++) {
      try {
        await this.connectMcp();
        return;
      } catch (error) {
        lastError = error instanceof Error ? error : new Error(String(error));
        if (attempt < MAX_RECONNECT_RETRIES - 1) {
          const delay = RECONNECT_BASE_DELAY_MS * Math.pow(2, attempt);
          debugLogger.log(
            `Connection attempt ${attempt + 1} failed, retrying in ${delay}ms...`,
          );
          await new Promise((resolve) => setTimeout(resolve, delay));

View on GitHub (pinned to 5024443c72)

Solutions

  1. Re-run the browser agent and choose to accept / confirm the privacy notice when prompted.
  2. If consent was wrongly declined, the dialog reappears on the next run because the sentinel file was never written.
  3. To pre-acknowledge in a managed setup, create the sentinel file at ~/.gemini/cli-browser-profile/browser-consent-acknowledged.txt.
  4. If the prompt does not appear, ensure a ConsentRequest listener is registered by the UI shell.
Defensive patterns

Strategy: validation

Validate before calling

import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { Storage } from './config/storage.js';
async function isConsentPresent() {
  const f = path.join(Storage.getGlobalGeminiDir(), 'cli-browser-profile', 'browser-consent-acknowledged.txt');
  try { await fs.access(f); return true; } catch { return false; }
}

Try / catch

try {
  await bm.ensureConnection();
} catch (e) {
  if (e instanceof Error && /user consent/.test(e.message)) {
    // re-run interactively and accept, or pre-create the sentinel file
  }
  throw e;
}

Prevention

When it happens

Trigger: First browser-agent use on a fresh profile in an interactive session: getBrowserConsentIfNeeded emits a ConsentRequest; the user selects 'No' / declines; resolve(false) -> connectWithRetry throws immediately, before any connectMcp attempt.

Common situations: First run after install or after deleting ~/.gemini/cli-browser-profile/browser-consent-acknowledged.txt; user declined intentionally; a UI bug routes 'No' incorrectly; non-interactive runs skip consent (return true) so this only happens interactively.

Related errors


AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12). Data as JSON: /api/errors/651271bda939a0e0. Report an issue: GitHub.