{"record":{"id":"021036d53b4bbf24","repo":"HKUDS/Vibe-Trading","slug":"feishu-lark-registration-did-not-return-a-login","errorCode":null,"errorMessage":"Feishu / Lark registration did not return a login URL","messagePattern":"Feishu / Lark registration did not return a login URL","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agent/src/channels/feishu.py","lineNumber":503,"sourceCode":"            f\"Supported: {methods}\"\n        )\n\n\ndef _begin_registration(domain: str = \"feishu\") -> dict:\n    \"\"\"Start the device-code flow. Returns device_code, qr_url, interval, expire_in.\"\"\"\n    base_url = _accounts_base_url(domain)\n    res = _post_registration(base_url, {\n        \"action\": \"begin\",\n        \"archetype\": \"PersonalAgent\",\n        \"auth_method\": \"client_secret\",\n        \"request_user_info\": \"open_id\",\n    })\n    device_code = res.get(\"device_code\")\n    if not device_code:\n        raise RuntimeError(\"Feishu / Lark registration did not return a device_code\")\n    qr_url = res.get(\"verification_uri_complete\", \"\")\n    if not qr_url:\n        raise RuntimeError(\"Feishu / Lark registration did not return a login URL\")\n    return {\n        \"device_code\": device_code,\n        \"qr_url\": qr_url,\n        \"interval\": res.get(\"interval\") or 5,\n        \"expire_in\": res.get(\"expire_in\") or 600,\n    }\n\n\ndef _poll_registration(\n    *,\n    device_code: str,\n    interval: int,\n    expire_in: int,\n    domain: str = \"feishu\",\n) -> dict | None:\n    \"\"\"Poll until the user scans the QR code, or timeout/denial.\n\n    Returns dict with app_id, app_secret, domain on success, None on failure.","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/channels/feishu.py#L485-L521","documentation":"Raised by _begin_registration when the Feishu/Lark device-code registration response contains a device_code but no verification_uri_complete field. The QR login flow cannot proceed because there is no URL to render as a QR code for the user to scan. It indicates the registration endpoint responded but with an incomplete/Unexpected payload.","triggerScenarios":"Calling the Feishu device-code registration endpoint (the call whose response is parsed into res) and receiving JSON with device_code set but verification_uri_complete missing, empty, or renamed. Only hit from _qr_register_inner during QR-based registration startup.","commonSituations":"Feishu/Lark API version changes renaming the field, regional Lark vs Feishu endpoints returning different payload shapes, app_id/app_key misconfiguration causing an error body that still includes a device_code-like field, or a proxy/gateway stripping fields.","solutions":["Inspect the raw registration response (log res) to see the actual payload keys returned by your Feishu/Lark endpoint","Verify the app credentials (app_id/app_secret) and that the app has the Device Code / QR login scope enabled in the Feishu open platform console","Check whether you're hitting Feishu (open.feishu.cn) vs Lark (open.larksuite.com) and that the registration URL matches your app's region","Fall back to verification_uri if verification_uri_complete is absent","Upgrade vibe-trading-ai in case the field mapping was fixed for a newer API version"],"exampleFix":"// before\nqr_url = res.get(\"verification_uri_complete\", \"\")\nif not qr_url:\n    raise RuntimeError(\"Feishu / Lark registration did not return a login URL\")\n\n// after\nqr_url = res.get(\"verification_uri_complete\") or res.get(\"verification_uri\", \"\")\nif not qr_url:\n    raise RuntimeError(\"Feishu / Lark registration did not return a login URL\")","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try:\n    result = await channel._qr_register_inner()\nexcept RuntimeError as e:\n    if \"login URL\" in str(e):\n        logger.error(\"feishu registration incomplete: %s\", e)\n        raise RegistrationIncomplete(str(e)) from e\n    raise","preventionTips":["Log the full registration response during integration to catch payload-shape drift early","Pin the Feishu/Lark SDK/API version you tested against","Monitor for Feishu open-platform deprecation notices on device-code login"],"tags":["feishu","lark","oauth","device-code","qr-login","registration"],"backgroundTag":"oauth-device-code-flow-failed","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}