HKUDS/Vibe-Trading · error · RuntimeError

Feishu / Lark registration did not return a device_code

Error message

Feishu / Lark registration did not return a device_code

What it means

During QR registration the begin-step response must include a device_code used for polling; a missing/empty device_code means the registration server returned an unexpected payload, so registration cannot proceed and a RuntimeError is raised.

Source

Thrown at agent/src/channels/feishu.py:500

    if "client_secret" not in methods:
        raise RuntimeError(
            f"Feishu / Lark registration does not support client_secret auth. "
            f"Supported: {methods}"
        )


def _begin_registration(domain: str = "feishu") -> dict:
    """Start the device-code flow. Returns device_code, qr_url, interval, expire_in."""
    base_url = _accounts_base_url(domain)
    res = _post_registration(base_url, {
        "action": "begin",
        "archetype": "PersonalAgent",
        "auth_method": "client_secret",
        "request_user_info": "open_id",
    })
    device_code = res.get("device_code")
    if not device_code:
        raise RuntimeError("Feishu / Lark registration did not return a device_code")
    qr_url = res.get("verification_uri_complete", "")
    if not qr_url:
        raise RuntimeError("Feishu / Lark registration did not return a login URL")
    return {
        "device_code": device_code,
        "qr_url": qr_url,
        "interval": res.get("interval") or 5,
        "expire_in": res.get("expire_in") or 600,
    }


def _poll_registration(
    *,
    device_code: str,
    interval: int,
    expire_in: int,
    domain: str = "feishu",
) -> dict | None:

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Retry the QR login flow — transient malformed responses do occur
  2. Verify domain and app credentials (bad creds can yield error bodies missing fields)
  3. Enable HTTP logging of _post_registration responses to inspect the raw payload
  4. If persistent, report upstream: the begin-registration contract appears violated
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(3):
    try:
        begin_registration(domain)
        break
    except RuntimeError as e:
        if 'device_code' not in str(e) or attempt == 2: raise
        time.sleep(2 ** attempt)

Prevention

When it happens

Trigger: Calling _begin_registration when the registration endpoint responds without device_code — API version change, malformed response, error body not surfaced as an exception, or rate-limit-style responses with a partial payload.

Common situations: Registration API contract changes on the server, intermittent proxy interference rewriting responses, or region endpoints with divergent behavior.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/349e432bb5bf44a2. Report an issue: GitHub.