{"record":{"id":"e106b36b1760faaa","repo":"binary-husky/gpt_academic","slug":"error-e106b3","errorCode":null,"errorMessage":"error","messagePattern":"error","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"request_llms/bridge_newbingfree.py","lineNumber":226,"sourceCode":"    llm_kwargs,\n    history=[],\n    sys_prompt=\"\",\n    observe_window=[],\n    console_silence=False,\n):\n    \"\"\"\n    多线程方法\n    函数的说明请见 request_llms/bridge_all.py\n    \"\"\"\n    global newbingfree_handle\n    if (newbingfree_handle is None) or (not newbingfree_handle.success):\n        newbingfree_handle = NewBingHandle()\n        if len(observe_window) >= 1:\n            observe_window[0] = load_message + \"\\n\\n\" + newbingfree_handle.info\n        if not newbingfree_handle.success:\n            error = newbingfree_handle.info\n            newbingfree_handle = None\n            raise RuntimeError(error)\n\n    # 没有 sys_prompt 接口，因此把prompt加入 history\n    history_feedin = []\n    for i in range(len(history) // 2):\n        history_feedin.append([history[2 * i], history[2 * i + 1]])\n\n    watch_dog_patience = 5  # 看门狗 (watchdog) 的耐心, 设置5秒即可\n    response = \"\"\n    if len(observe_window) >= 1:\n        observe_window[0] = \"[Local Message] 等待NewBing响应中 ...\"\n    for response in newbingfree_handle.stream_chat(\n        query=inputs,\n        history=history_feedin,\n        system_prompt=sys_prompt,\n        max_length=llm_kwargs[\"max_length\"],\n        top_p=llm_kwargs[\"top_p\"],\n        temperature=llm_kwargs[\"temperature\"],\n    ):","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/bridge_newbingfree.py#L208-L244","documentation":"In newbing_predict_no_ui_long_connection: if the handle is None or its previous load failed (not .success), a new NewBingHandle() is created; when loading still fails, handle.info (e.g. the cookies error from error 136, the constructor error from error 137, or '等待NewBing响应中' era network failures) is captured as `error`, the handle is reset to None, and RuntimeError(error) re-raises it in the caller's thread.","triggerScenarios":"First (or retry-after-failure) call to the NewBing streaming predict while the loader thread failed — bad cookies JSON, constructor/proxy failure, or the async NewBing request loop dying with a network error, leaving success=False and info populated.","commonSituations":"Expired NewBing cookies, changed upstream endpoints on an unmaintained component, unreachable proxy, or a previous failure leaving newbingfree_handle None so every call re-attempts the load.","solutions":["Inspect newbingfree_handle.info / observe_window[0] — the raised text is exactly the loader's last message; address that root cause (cookies JSON, proxy, deps).","Validate NEWBING_COOKIES with json.loads before letting the handle start.","Fix the proxy config or disable USE_PROXY.","Migrate off the NewBing backend — it is declared unmaintained in the error text itself."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import json\ndef newbing_ready(cfg) -> bool:\n    c = cfg.get('NEWBING_COOKIES')\n    if c and len(c) > 100:\n        try: json.loads(c)\n        except json.JSONDecodeError: return False\n    return True  # plus proxy URL sanity check","typeGuard":null,"tryCatchPattern":"try:\n    resp = newbing_predict_no_ui_long_connection(...)\nexcept RuntimeError as e:\n    chatbot.append(('system', f'NewBing unavailable: {e}'))  # e is handle.info; fix root cause","preventionTips":["Check handle.info in observe_window[0] for the true cause","Validate cookies JSON and proxy before first request","Handle resets to None on failure — fix config then retry once"],"tags":["newbing","error-propagation","config","deprecated"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}