binary-husky/gpt_academic · error · RuntimeError

claude_handle.info

Error message

claude_handle.info

What it means

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).

Source

Thrown at request_llms/bridge_stackclaude.py:241

    inputs,
    llm_kwargs,
    history=[],
    sys_prompt="",
    observe_window=None,
    console_silence=False,
):
    """
    多线程方法
    函数的说明请见 request_llms/bridge_all.py
    """
    global claude_handle
    if (claude_handle is None) or (not claude_handle.success):
        claude_handle = ClaudeHandle()
        observe_window[0] = load_message + "\n\n" + claude_handle.info
        if not claude_handle.success:
            error = claude_handle.info
            claude_handle = None
            raise RuntimeError(error)

    # 没有 sys_prompt 接口,因此把prompt加入 history
    history_feedin = []
    for i in range(len(history) // 2):
        history_feedin.append([history[2 * i], history[2 * i + 1]])

    watch_dog_patience = 5  # 看门狗 (watchdog) 的耐心, 设置5秒即可
    response = ""
    observe_window[0] = "[Local Message] 等待Claude响应中 ..."
    for response in claude_handle.stream_chat(
        query=inputs,
        history=history_feedin,
        system_prompt=sys_prompt,
        max_length=llm_kwargs["max_length"],
        top_p=llm_kwargs["top_p"],
        temperature=llm_kwargs["temperature"],
    ):
        observe_window[0] = preprocess_newbing_out_simple(response)

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Read the string carried by the exception — it embeds the original traceback that explains the init failure
  2. Fix the underlying init problem (SLACK_CLAUDE_USER_TOKEN value, slack sdk install, proxy URL)
  3. Test handle creation in isolation: from request_llms.bridge_stackclaude import ClaudeHandle; h = ClaudeHandle(); print(h.success, h.info)
  4. After fixing config, restart the process so the module-level claude_handle global is rebuilt
Defensive patterns

Strategy: try-catch

Validate before calling

from request_llms.bridge_stackclaude import ClaudeHandle
h = ClaudeHandle()
if not h.success:
    raise RuntimeError(f'ClaudeHandle init failed: {h.info}')  # fail before user request

Try / catch

try:
    predict_no_ui_long_connection(...)
except RuntimeError as e:
    logger.error('stackclaude init failure: %s', e)  # e carries the init traceback
    raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/c3e05c6d774b7265. Report an issue: GitHub.