HKUDS/Vibe-Trading · error · RuntimeError

Feishu / Lark registration does not support client_secret au

Error message

Feishu / Lark registration does not support client_secret auth. Supported: {methods}

What it means

Feishu/Lark QR registration uses client_secret auth; the registration init endpoint reports which auth methods the server supports, and if client_secret isn't among them a RuntimeError is raised. This typically indicates server-side capability or app-type mismatch.

Source

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

        url,
        data=body,
        timeout=_ONBOARD_REQUEST_TIMEOUT_S,
        headers={"Content-Type": "application/x-www-form-urlencoded"},
    )
    try:
        return resp.json()
    except json.JSONDecodeError:
        resp.raise_for_status()
        return {}


def _init_registration(domain: str = "feishu") -> None:
    """Verify the environment supports client_secret auth. Raises RuntimeError if not."""
    base_url = _accounts_base_url(domain)
    res = _post_registration(base_url, {"action": "init"})
    methods = res.get("supported_auth_methods") or []
    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", "")

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Verify domain: pass domain='feishu' for CN or 'lark' for international as appropriate for your app
  2. Check the app type in the Feishu open platform — it must support client_secret (token) auth
  3. Confirm app_id/app_secret are for a custom app, not an ISV/store app
  4. Inspect the raw response: the error lists the actually supported methods, which reveals what changed
Defensive patterns

Strategy: fallback

Validate before calling

res = post(base_url, {'action':'init'})
assert 'client_secret' in (res.get('supported_auth_methods') or []), 'auth method unsupported'

Try / catch

try:
    qr_register(domain='feishu')
except RuntimeError as e:
    if 'client_secret' in str(e): fall_back_to_manual_token_flow()
    raise

Prevention

When it happens

Trigger: Calling _init_registration (via QR login flow) when the registration endpoint's supported_auth_methods list lacks 'client_secret' — wrong app archetype, unsupported Feishu region/domain, or server-side policy change.

Common situations: Using a Lark (international) vs Feishu (CN) domain mismatch, custom app credentials of the wrong type (store/ISV app), or the registration API being updated to deprecate client_secret.

Related errors


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