{"record":{"id":"c3e05c6d774b7265","repo":"binary-husky/gpt_academic","slug":"claude-handle-info","errorCode":null,"errorMessage":"claude_handle.info","messagePattern":"claude_handle\\.info","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"request_llms/bridge_stackclaude.py","lineNumber":241,"sourceCode":"    inputs,\n    llm_kwargs,\n    history=[],\n    sys_prompt=\"\",\n    observe_window=None,\n    console_silence=False,\n):\n    \"\"\"\n    多线程方法\n    函数的说明请见 request_llms/bridge_all.py\n    \"\"\"\n    global claude_handle\n    if (claude_handle is None) or (not claude_handle.success):\n        claude_handle = ClaudeHandle()\n        observe_window[0] = load_message + \"\\n\\n\" + claude_handle.info\n        if not claude_handle.success:\n            error = claude_handle.info\n            claude_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    observe_window[0] = \"[Local Message] 等待Claude响应中 ...\"\n    for response in claude_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    ):\n        observe_window[0] = preprocess_newbing_out_simple(response)","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/bridge_stackclaude.py#L223-L259","documentation":"This RuntimeError is the generic 'handle failed to start' signal of the Slack Claude bridge: when ClaudeHandle() construction fails, the code stores the failure description in claude_handle.info and predict_no_ui_long_connection raises RuntimeError(claude_handle.info). The message in the error list is literally the attribute access expression, i.e. the raised text equals whatever info contains (usually a [Local Message] + traceback string).","triggerScenarios":"First call (or first call after a previous failure set claude_handle = None) to predict_no_ui_long_connection in request_llms/bridge_stackclaude.py:241 when ClaudeHandle.__init__ exits with self.success = False — same root causes as the '不能加载Claude组件。' error (missing token, missing slack dependency, proxy error).","commonSituations":"Stale module-level claude_handle from an earlier failed init being recreated each request and failing the same way; environment where the slack sdk import fails; token misconfigured so every ClaudeHandle construction fails and every request surfaces info.","solutions":["Read the string carried by the exception — it embeds the original traceback that explains the init failure","Fix the underlying init problem (SLACK_CLAUDE_USER_TOKEN value, slack sdk install, proxy URL)","Test handle creation in isolation: from request_llms.bridge_stackclaude import ClaudeHandle; h = ClaudeHandle(); print(h.success, h.info)","After fixing config, restart the process so the module-level claude_handle global is rebuilt"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from request_llms.bridge_stackclaude import ClaudeHandle\nh = ClaudeHandle()\nif not h.success:\n    raise RuntimeError(f'ClaudeHandle init failed: {h.info}')  # fail before user request","typeGuard":null,"tryCatchPattern":"try:\n    predict_no_ui_long_connection(...)\nexcept RuntimeError as e:\n    logger.error('stackclaude init failure: %s', e)  # e carries the init traceback\n    raise","preventionTips":["Warm up ClaudeHandle once at startup so user requests never pay init failures","Read the info string fully; it contains the root-cause traceback","Restart the process after fixing config so the module global rebuilds cleanly"],"tags":["claude-bridge","initialization","error-propagation","slack"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}