{"record":{"id":"651271bda939a0e0","repo":"google-gemini/gemini-cli","slug":"browser-agent-requires-user-consent-to-proceed-pl","errorCode":null,"errorMessage":"Browser agent requires user consent to proceed. Please re-run and accept the privacy notice.","messagePattern":"Browser agent requires user consent to proceed\\. Please re-run and accept the privacy notice\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/browser/browserManager.ts","lineNumber":489,"sourceCode":"      this.disconnected = false;\n    }\n\n    // Start connecting; store the promise so concurrent callers can join it\n    this.connectionPromise = this.connectWithRetry().finally(() => {\n      this.connectionPromise = undefined;\n    });\n\n    return this.connectionPromise;\n  }\n\n  /**\n   * Connects to chrome-devtools-mcp with exponential backoff retry.\n   */\n  private async connectWithRetry(): Promise<void> {\n    // Request browser consent if needed (first-run privacy notice)\n    const consentGranted = await getBrowserConsentIfNeeded();\n    if (!consentGranted) {\n      throw new Error(\n        'Browser agent requires user consent to proceed. ' +\n          'Please re-run and accept the privacy notice.',\n      );\n    }\n\n    let lastError: Error | undefined;\n    for (let attempt = 0; attempt < MAX_RECONNECT_RETRIES; attempt++) {\n      try {\n        await this.connectMcp();\n        return;\n      } catch (error) {\n        lastError = error instanceof Error ? error : new Error(String(error));\n        if (attempt < MAX_RECONNECT_RETRIES - 1) {\n          const delay = RECONNECT_BASE_DELAY_MS * Math.pow(2, attempt);\n          debugLogger.log(\n            `Connection attempt ${attempt + 1} failed, retrying in ${delay}ms...`,\n          );\n          await new Promise((resolve) => setTimeout(resolve, delay));","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/core/src/agents/browser/browserManager.ts#L471-L507","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run the browser agent and choose to accept / confirm the privacy notice when prompted.","If consent was wrongly declined, the dialog reappears on the next run because the sentinel file was never written.","To pre-acknowledge in a managed setup, create the sentinel file at ~/.gemini/cli-browser-profile/browser-consent-acknowledged.txt.","If the prompt does not appear, ensure a ConsentRequest listener is registered by the UI shell."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { Storage } from './config/storage.js';\nasync function isConsentPresent() {\n  const f = path.join(Storage.getGlobalGeminiDir(), 'cli-browser-profile', 'browser-consent-acknowledged.txt');\n  try { await fs.access(f); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await bm.ensureConnection();\n} catch (e) {\n  if (e instanceof Error && /user consent/.test(e.message)) {\n    // re-run interactively and accept, or pre-create the sentinel file\n  }\n  throw e;\n}","preventionTips":["Accept the privacy notice on first run.","For managed setups, pre-create the sentinel file under ~/.gemini/cli-browser-profile/.","Ensure a ConsentRequest UI listener is registered in interactive mode."],"tags":["browser","consent","first-run","privacy"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}