{"record":{"id":"50a0bac74bc47f0a","repo":"HKUDS/nanobot","slug":"exc","errorCode":null,"errorMessage":"{exc}","messagePattern":"\\{exc\\}","errorType":"http","errorClass":"ChannelConnectError","httpStatus":400,"severity":"error","filePath":"nanobot/channels/feishu/connect.py","lineNumber":201,"sourceCode":"    def _cleanup(self) -> None:\n        now = time.monotonic()\n        expired = [session_id for session_id, session in self._sessions.items() if now >= session.deadline]\n        for session_id in expired:\n            self._sessions.pop(session_id, None)\n\n\ndef _normalize_domain(domain: str) -> str:\n    normalized = domain.strip().lower()\n    return normalized if normalized in {\"feishu\", \"lark\"} else \"feishu\"\n\n\ndef _resolve_instance_id(instance_id: str, mode: str) -> str:\n    if mode == \"create\":\n        return f\"assistant-{secrets.token_hex(3)}\"\n    try:\n        return validate_instance_id(instance_id or DEFAULT_INSTANCE_ID)\n    except ValueError as exc:\n        raise ChannelConnectError(str(exc), status=400) from exc\n\n\ndef _default_instance_name(instance_id: str) -> str:\n    return \"nanobot\" if instance_id == DEFAULT_INSTANCE_ID else f\"nanobot {instance_id}\"\n\n\ndef _start_payload(session: FeishuConnectSession) -> dict[str, Any]:\n    return {\n        \"session_id\": session.id,\n        \"instance_id\": session.instance_id,\n        \"status\": \"pending\",\n        \"qr_url\": session.qr_url,\n        \"domain\": session.domain,\n        \"interval_ms\": session.interval * 1000,\n        \"expires_at_ms\": int((session.created_wall + session.expire_in) * 1000),\n        \"message\": \"Scan with Feishu or Lark to connect.\",\n    }\n","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/feishu/connect.py#L183-L219","documentation":"Error \"{exc}\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/channels/feishu/connect.py:201 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}