Skip to content

[反馈]: web反代报错,浏览器ws连接失败 #86

@QQbot-cotton

Description

@QQbot-cotton

部署平台

Docker

版本号

v0.6.3

客户端/工具

Astrbot

请求接口

Gemini

问题/请求描述

我在调用AI时,Astrbot返回了503报错

登上代理端后,日志有报ws连接错误和TLS握手中断

我开了V2ray进行http代理,其中我把http分流端口和规则端口都试了一遍,都报以上日志
我在手机上使用同一反代IP和谷歌账号,访问Google AI Studio没问题,也能进行AI输出

日志信息(可选)

Astrbot日志:
[2026-02-22 20:15:00.536] [Core] [WARN] [v4.17.0] [runners.tool_loop_agent_runner:247]: Chat Model google_gemini/gemini-2.5-flash request error: 503 SERVICE_UNAVAILABLE. {'error': {'code': 503, 'message': 'Service temporarily unavailable: Browser crashed and cannot auto-recover.', 'status': 'SERVICE_UNAVAILABLE'}}
Traceback (most recent call last):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 222, in _iter_llm_responses_with_fallback
    async for resp in self._iter_llm_responses(include_model=idx == 0):
  File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 199, in _iter_llm_responses
    yield await self.provider.text_chat(**payload)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 769, in text_chat
    if await self._handle_api_error(e, keys):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 128, in _handle_api_error
    raise e
  File "/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 767, in text_chat
    return await self._query(payloads, func_tool)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/AstrBot/astrbot/core/provider/sources/gemini_source.py", line 542, in _query
    result = await self.client.models.generate_content(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/google/genai/models.py", line 7298, in generate_content
    return await self._generate_content(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/google/genai/models.py", line 6095, in _generate_content
    response = await self._api_client.async_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/google/genai/_api_client.py", line 1442, in async_request
    result = await self._async_request(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/google/genai/_api_client.py", line 1375, in _async_request
    return await self._async_retry(  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 112, in __call__
    do = await self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 157, in iter
    result = await action(retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/_utils.py", line 111, in inner
    return call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 413, in exc_check
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 184, in reraise
    raise self.last_attempt.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 116, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/google/genai/_api_client.py", line 1320, in _async_request_once
    await errors.APIError.raise_for_async_response(response)
  File "/usr/local/lib/python3.12/site-packages/google/genai/errors.py", line 216, in raise_for_async_response
    await cls.raise_error_async(status_code, response_json, response)
  File "/usr/local/lib/python3.12/site-packages/google/genai/errors.py", line 240, in raise_error_async
    raise ServerError(status_code, response_json, response)
google.genai.errors.ServerError: 503 SERVICE_UNAVAILABLE. {'error': {'code': 503, 'message': 'Service temporarily unavailable: Browser crashed and cannot auto-recover.', 'status': 'SERVICE_UNAVAILABLE'}}
[2026-02-22 20:15:00.546] [Core] [WARN] [v4.17.0] [runners.tool_loop_agent_runner:214]: Switched from google_gemini/gemini-2.5-flash to fallback chat provider: siliconflow

反代端日志(调试模式):
[INFO] 2026-02-22 12:19:44.142 [UTC] [ProxySystem] - [WebUI] Log level switched to: DEBUG
[WARN] 2026-02-22 12:19:44.142 [UTC] [ProxySystem] - [Config] Unable to set browser log level: No available WebSocket connection.
[WARN] 2026-02-22 12:19:44.143 [UTC] [ProxySystem] - [WebUI] Browser log level sync failed (no active connection)
[INFO] 2026-02-22 12:20:04.645 [UTC] [ProxySystem] - [Entrypoint] Received a request: POST /v1beta/models/gemini-2.5-flash:generateContent
[INFO] 2026-02-22 12:20:04.646 [UTC] [ProxySystem] - [Auth] API Key verification passed (from: 172.18.0.1)
[ERROR] 2026-02-22 12:20:04.647 [UTC] [ProxySystem] - ❌ [System] Browser WebSocket connection disconnected! Possible process crash. Attempting recovery...
[INFO] 2026-02-22 12:20:04.647 [UTC] [ProxySystem] - [System] Set isSystemBusy=true for direct recovery to account #1
[INFO] 2026-02-22 12:20:05.029 [UTC] [ProxySystem] - [Auth Update] 💾 Successfully updated auth credentials for account #1
[INFO] 2026-02-22 12:20:05.030 [UTC] [ProxySystem] - [Browser] 🌐 Using proxy: 192.168.3.9:7891
[INFO] 2026-02-22 12:20:05.030 [UTC] [ProxySystem] - [Browser] Stopped background tasks (Scavenger) for old page.
[INFO] 2026-02-22 12:20:05.030 [UTC] [ProxySystem] - [Browser] Closing old API browser context...
[INFO] 2026-02-22 12:20:05.064 [UTC] [ProxySystem] - [Browser] Old API context closed.
[INFO] 2026-02-22 12:20:05.065 [UTC] [ProxySystem] - ==================================================
[INFO] 2026-02-22 12:20:05.065 [UTC] [ProxySystem] - 🔄 [Browser] Creating new API browser context for account #1
[INFO] 2026-02-22 12:20:05.065 [UTC] [ProxySystem] -    • Auth source: File auth-1.json
[INFO] 2026-02-22 12:20:05.066 [UTC] [ProxySystem] - ==================================================
[INFO] 2026-02-22 12:20:05.066 [UTC] [ProxySystem] - [Config] Found LOG_LEVEL config line:     currentLevel: 1,
[INFO] 2026-02-22 12:20:05.067 [UTC] [ProxySystem] - [Config] Replaced with:     currentLevel: 0, // Injected: DEBUG
[INFO] 2026-02-22 12:20:06.067 [UTC] [ProxySystem] - [Browser] ⚡ Forced window wake-up via JS focus.
[INFO] 2026-02-22 12:20:06.068 [UTC] [ProxySystem] - [Browser] Navigating to target page...
[INFO] 2026-02-22 12:20:09.117 [UTC] [ProxySystem] - [Browser] Privacy protection layer active: Intel Iris OpenGL Engine
[INFO] 2026-02-22 12:20:09.138 [UTC] [ProxySystem] - [Browser] Privacy protection layer active: Intel Iris OpenGL Engine
[INFO] 2026-02-22 12:20:15.819 [UTC] [ProxySystem] - [Browser] Page loaded.
[INFO] 2026-02-22 12:20:16.819 [UTC] [ProxySystem] - [Browser] ✅ Executed realistic page activation (Random -> 1,1 Click).
[INFO] 2026-02-22 12:20:20.782 [UTC] [ProxySystem] - [Browser] [Diagnostic] URL: https://aistudio.google.com/u/0/apps/bundled/blank?showPreview=true&showCode=true&showAssistant=true
[INFO] 2026-02-22 12:20:20.783 [UTC] [ProxySystem] - [Browser] [Diagnostic] Title: "Google AI Studio"
[INFO] 2026-02-22 12:20:20.783 [UTC] [ProxySystem] - [Browser] 🔍 Starting intelligent popup detection (max 6s)...
[INFO] 2026-02-22 12:20:23.785 [UTC] [ProxySystem] - [Browser] ✅ Popup detection complete (6 iterations, 0 popups handled)
[INFO] 2026-02-22 12:20:23.785 [UTC] [ProxySystem] - [Browser] Preparing UI interaction, forcefully removing all possible overlay layers...
[INFO] 2026-02-22 12:20:23.796 [UTC] [ProxySystem] - [Browser] (Step 1/5) Preparing to click "Code" button...
[INFO] 2026-02-22 12:20:23.797 [UTC] [ProxySystem] -   [Attempt 1/15] Cleaning overlay layers and clicking...
[INFO] 2026-02-22 12:20:24.300 [UTC] [ProxySystem] - [Browser] Trying to locate "Code" entry point using smart selectors...
[INFO] 2026-02-22 12:20:24.307 [UTC] [ProxySystem] - [Browser] ✅ Smart match: "button:text("Code")", clicking...
[INFO] 2026-02-22 12:20:24.387 [UTC] [ProxySystem] -   ✅ Click successful!
[INFO] 2026-02-22 12:20:24.388 [UTC] [ProxySystem] - [Browser] (Step 2/5) "Code" button clicked successfully, waiting for editor to become visible...
[INFO] 2026-02-22 12:20:27.762 [UTC] [ProxySystem] - [Browser] (Cleanup #2) Preparing to click editor, forcefully removing all possible overlay layers again...
[INFO] 2026-02-22 12:20:28.014 [UTC] [ProxySystem] - [Browser] (Step 3/5) Editor displayed, focusing and pasting script...
[INFO] 2026-02-22 12:20:28.136 [UTC] [ProxySystem] - [Browser] (Step 4/5) Script pasted.
[INFO] 2026-02-22 12:20:28.137 [UTC] [ProxySystem] - [Browser] (Step 5/5) Clicking "Preview" button to activate script...
[INFO] 2026-02-22 12:20:28.288 [UTC] [ProxySystem] - [Browser] ✅ UI interaction complete, script is now running.
[INFO] 2026-02-22 12:20:28.288 [UTC] [ProxySystem] - [Browser] ⚡ Sending active trigger request to Launch flow...
[INFO] 2026-02-22 12:20:39.478 [UTC] [ProxySystem] - [Browser] 🛡️ Background health monitor service (Scavenger) started...
[INFO] 2026-02-22 12:20:39.801 [UTC] [ProxySystem] - [Auth Update] 💾 Successfully updated auth credentials for account #1
[INFO] 2026-02-22 12:20:39.801 [UTC] [ProxyS[INFO] 2026-02-22 12:20:39.803 [UTC] [ProxySystem] - ✅ [System] Browser successfully recovered to account #1!
[INFO] 2026-02-22 12:20:39.803 [UTC] [ProxySystem] - [System] Waiting for WebSocket connection to be ready...
[INFO] 2026-02-22 12:20:40.980 [UTC] [ProxySystem] - [Browser] 🛡️ Background Wakeup Service (Rocket Handler) started...
[ERROR] 2026-02-22 12:20:49.809 [UTC] [ProxySystem] - ❌ [System] Recovery failed: WebSocket connection not established within timeout period
[INFO] 2026-02-22 12:20:49.810 [UTC] [ProxySystem] - [System] Resetting isSystemBusy=false in recovery finally block

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions