binary-husky/gpt_academic · error · Exception
Update web page context failed
Error message
Update web page context failed
What it means
ChatHub handshake failure: before streaming a prompt, _ChatHub.ask sends a web-context update POST to conversation/create-style endpoint carrying the page context/conversation signature; a non-200 response triggers Exception('Update web page context failed'). Printed status/body/url identify the rejection.
Source
Thrown at request_llms/edge_gpt_free.py:508
{
"author": "user",
"description": webpage_context,
"contextType": "WebPage",
"messageType": "Context",
},
],
"conversationId": self.request.conversation_id,
"source": "cib",
"traceId": _get_ran_hex(32),
"participant": {"id": self.request.client_id},
"conversationSignature": self.request.conversation_signature,
},
)
if response.status_code != 200:
print(f"Status code: {response.status_code}")
print(response.text)
print(response.url)
raise Exception("Update web page context failed")
# Construct a ChatHub request
self.request.update(
prompt=prompt,
conversation_style=conversation_style,
options=options,
)
# Send request
await self.wss.send_str(_append_identifier(self.request.struct))
final = False
draw = False
resp_txt = ""
result_text = ""
resp_txt_no_link = ""
while not final:
msg = await self.wss.receive()
try:
objects = msg.data.split(DELIMITER)
except:View on GitHub (pinned to d6bde0fa54)
Solutions
- Create a fresh conversation (new cookies/signature) instead of reusing a long-lived one
- Check printed status: 401/403 → refresh cookies; 429 → back off and retry later
- Verify BING_PROXY_URL forwards the context-update endpoint, not just conversation/create
- Catch this exception and auto-recreate the conversation once before giving up
Example fix
# before
try:
async for resp in chathub.ask(prompt):
...
except Exception:
raise
# after: recreate conversation once on handshake failure
try:
async for resp in chathub.ask(prompt):
...
except Exception as e:
if 'Update web page context failed' in str(e):
chatbot = await Chatbot.create(cookies=COOKIES, proxy=PROXY) # fresh signature
async for resp in chatbot.ask(prompt):
... Defensive patterns
Strategy: fallback
Validate before calling
import time
if conversation.created_at and time.time() - conversation.created_at > 15*60:
conversation = await Chatbot.create(cookies=COOKIES, proxy=PROXY) # refresh before signature expires Try / catch
try:
async for resp in chathub.ask(prompt):
...
except Exception as e:
if 'Update web page context failed' in str(e):
chatbot = await Chatbot.create(cookies=COOKIES, proxy=PROXY) # fresh conversation, one retry
async for resp in chatbot.ask(prompt):
...
else:
raise Prevention
- Treat Bing conversation signatures as short-lived; recreate per task
- Check the printed status code: 429 -> backoff, 401/403 -> refresh cookies
- Wrap ask() with exactly one conversation-recreate retry, then surface the error
When it happens
Trigger: request_llms/edge_gpt_free.py:508: the initial context-update request in ask() returns non-200 — expired or invalid conversationSignature/conversationId, rate-limited IP, or the (proxy) endpoint rejecting the payload shape. It fires per-message, so a session can work once then fail after signature expiry.
Common situations: Reusing a conversation object after its signature expired (~minutes); heavy usage triggering 429; cookies partially valid (create succeeded, chat rejected); churchless fallback proxy restrictive on the context update call.
Related errors
- Authentication failed
- Authentication failed. You have not been accepted into the b
- 在线搜索失败!\n{Exceptions}
- 无法下载资源{txt},请检查。
- Failed to download webpage after {self.config.max_retries} a
AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14).
Data as JSON: /api/errors/7b801352cbf40bf6.
Report an issue: GitHub.