bytedance/deer-flow · error · HTTPException
Failed to complete Lark connection setup.
Error message
Failed to complete Lark connection setup.
What it means
Generic 500 catch-all for POST /lark/config/complete (integrations.py:331). Exceptions from complete_lark_config outside FileNotFoundError/LarkFlowSupersededError/ValueError/TimeoutError — e.g. OSError writing credential files, JSON errors, or unexpected status-probe failures in get_lark_integration_status — are logged with traceback and returned opaquely.
Source
Thrown at backend/app/gateway/routers/integrations.py:331
config,
device_code=body.device_code,
generation=body.generation,
brand=body.brand,
interval=body.interval,
expires_in=body.expires_in,
)
return _config_complete_to_response(result, include_host_paths=await _is_admin_user(request))
except FileNotFoundError as e:
raise HTTPException(status_code=404, detail=str(e))
except LarkFlowSupersededError as e:
raise HTTPException(status_code=409, detail=str(e))
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
except TimeoutError as e:
raise HTTPException(status_code=504, detail=str(e))
except Exception as e:
logger.error("Failed to complete Lark connection setup: %s", e, exc_info=True)
raise HTTPException(status_code=500, detail="Failed to complete Lark connection setup.")
@router.post("/lark/config/credentials", response_model=LarkConfigCompleteResponse, summary="Switch Lark/Feishu App Credentials")
async def switch_lark_app_credentials(request: Request, body: LarkConfigCredentialsRequest, config: AppConfig = Depends(get_config)) -> LarkConfigCompleteResponse:
try:
result = await asyncio.to_thread(
set_lark_app_credentials,
get_effective_user_id(),
config,
app_id=body.app_id,
app_secret=body.app_secret,
brand=body.brand,
)
return _config_complete_to_response(result, include_host_paths=await _is_admin_user(request))
except FileNotFoundError as e:
raise HTTPException(status_code=404, detail=str(e))
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Inspect the 'Failed to complete Lark connection setup:' traceback in Gateway logs
- Verify the per-user Lark credential/state directory is writable by the Gateway process
- Retry complete with the same device_code/generation if the flow was not superseded; otherwise restart the flow
Defensive patterns
Strategy: try-catch
Try / catch
try { await complete(); } catch (e) {
if (e?.response?.status === 500) { const st = await api.get('/integrations/lark/status'); report(st.data); }
} Prevention
- Keep the credential directory writable by the Gateway user
- After any 500, reconcile state via GET /lark/status before retrying
When it happens
Trigger: Credential file write fails (disk full, permissions) inside _replace_lark_app_credentials_locked; status verification crashing after successful registration.
Common situations: Read-only volumes for the credential tree, container user lacking write perms, disk exhaustion on the Gateway host.
Related errors
- Failed to start Lark connection setup.
- Failed to switch Lark app credentials.
- Failed to install Lark integration.
- Failed to start Lark authorization.
- Failed to get Lark integration status.
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/ba6ae3d2ae881c9b.
Report an issue: GitHub.