odysseus-dev/odysseus · error · HTTPException

GOOGLE_OAUTH_CLIENT_ID not set — add it to .env

Error message

GOOGLE_OAUTH_CLIENT_ID not set — add it to .env

What it means

Error "GOOGLE_OAUTH_CLIENT_ID not set — add it to .env" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:6015

            clear_q = _email_account_owner_scope(
                db.query(EmailAccount), row.owner or ""
            )
            clear_q.update({EmailAccount.is_default: False})
            row.is_default = True
            db.commit()
            return {"ok": True}
        finally:
            db.close()

    # ── Google OAuth2 routes ──

    @router.get("/oauth/google/authorize")
    async def google_oauth_authorize(account_id: str = Query(...), request: Request = None, owner: str = Depends(require_user)):
        import urllib.parse
        _assert_owns_account(account_id, owner)
        client_id = os.environ.get("GOOGLE_OAUTH_CLIENT_ID", "")
        if not client_id:
            raise HTTPException(400, "GOOGLE_OAUTH_CLIENT_ID not set — add it to .env")
        redirect_uri = (
            os.environ.get("GOOGLE_OAUTH_REDIRECT_URI")
            or f"{request.url.scheme}://{request.headers.get('host', 'localhost:7000')}/api/email/oauth/google/callback"
        )
        state = make_oauth_state(account_id, owner)
        params = urllib.parse.urlencode({
            "client_id": client_id,
            "redirect_uri": redirect_uri,
            "response_type": "code",
            "scope": "https://mail.google.com/ email",
            "access_type": "offline",
            "prompt": "consent",
            "state": state,
        })
        from fastapi.responses import RedirectResponse as _RR
        return _RR(f"https://accounts.google.com/o/oauth2/v2/auth?{params}")

    @router.get("/oauth/google/callback")

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Add GOOGLE_OAUTH_CLIENT_ID to the .env file and restart the server.
  2. Create OAuth credentials in Google Cloud Console and configure the client id.

When it happens

Trigger: Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/7ef96ae901129949. Report an issue: GitHub.