bytedance/deer-flow · error · HTTPException

Failed to start Lark authorization.

Error message

Failed to start Lark authorization.

What it means

Generic 500 catch-all for POST /lark/auth/start (integrations.py:379). Exceptions outside FileNotFoundError/LarkFlowSupersededError/ValueError/TimeoutError — e.g. OSError from the CLI subprocess, permission errors re-hardening the credential tree in ensure_lark_cli_credential_tree, or JSON parse crashes — are logged with traceback and returned opaquely.

Source

Thrown at backend/app/gateway/routers/integrations.py:379

            start_lark_auth,
            get_effective_user_id(),
            domains=tuple(body.domains),
            scope=body.scope,
            recommend=body.recommend,
            generation=body.generation,
        )
        return _auth_start_to_response(result)
    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 start Lark authorization: %s", e, exc_info=True)
        raise HTTPException(status_code=500, detail="Failed to start Lark authorization.")


@router.post("/lark/auth/complete", response_model=LarkAuthCompleteResponse, summary="Complete Lark/Feishu Browser Authorization")
async def complete_lark_browser_auth(request: Request, body: LarkAuthCompleteRequest, config: AppConfig = Depends(get_config)) -> LarkAuthCompleteResponse:
    try:
        result = await asyncio.to_thread(
            complete_lark_auth,
            get_effective_user_id(),
            config,
            device_code=body.device_code,
            generation=body.generation,
            wait_timeout_seconds=body.wait_timeout_seconds,
        )
        return _auth_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))

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Read the 'Failed to start Lark authorization:' traceback in Gateway logs
  2. Check exec permissions on the managed lark-cli path for the Gateway service user
  3. Repair ownership of the credential tree or reinstall via /lark/install
  4. Retry after remediation; start re-issues safely
Defensive patterns

Strategy: try-catch

Try / catch

try { await authStart(body); } catch (e) {
  if (e?.response?.status === 500) captureMessage('lark auth start 500', { extra: e.response.data });
}

Prevention

When it happens

Trigger: lark-cli binary present but not executable by the Gateway user; the post-command credential-tree hardening failing on file permissions; corrupted JSON output crashing the parser.

Common situations: Wrong ownership on the managed CLI binary or credential dir, security software blocking exec, container user changes after install.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/f696e84902ef994f. Report an issue: GitHub.