Skip to content

Login fails with "api request returned error: 400" when using 2FA for email #318

Description

@dvaerum

Problem

rbw login fails with a generic 400 error when connecting to the official Bitwarden server (bitwarden.com).

Bitwarden seems to have changed the 2FA workflow, I am guessing that it is a bug/issue which only get triggered the 1st time one tries to login, but I could be wrong here.

When I try to login to Bitwarden and get the error rbw login: failed to log in to bitwarden instance: api request returned error: 400, I also receive an email with my 2FA code from Bitwarden, so something is working.

If you need anything else is need, please tell me and I will do what I can

Environment

  • rbw 1.15.0
  • Official Bitwarden server (bitwarden.com)
  • Email 2FA enabled
  • NixOS

Agent log (RUST_LOG=trace)

env RUST_LOG=trace rbw-agent --no-daemonize
[2026-02-21T15:27:31Z DEBUG rbw_agent::sock] listening on socket /run/user/1000/rbw/socket
[2026-02-21T15:27:31Z TRACE arboard::platform::linux] Successfully initialized the Wayland data control clipboard.
[2026-02-21T15:27:31Z INFO  ssh_agent_lib::agent] Listening; socket = UnixListener { fd: FileDesc(OwnedFd { fd: 11 }), local: "/run/user/1000/rbw/ssh-agent-socket" (pathname) }
qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: App info not found for 'org.gnupg.pinentry-qt'")
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::pool] checkout waiting for idle connection: ("https", identity.bitwarden.com)
[2026-02-21T15:27:47Z DEBUG reqwest::connect] starting new connection: https://identity.bitwarden.com/
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::connect::http] Http::connect; scheme=Some("https"), host=Some("identity.bitwarden.com"), port=None
[2026-02-21T15:27:47Z DEBUG hyper_util::client::legacy::connect::http] connecting to [2a04:4e42:4d::347]:443
[2026-02-21T15:27:47Z DEBUG hyper_util::client::legacy::connect::http] connected to [2a04:4e42:4d::347]:443
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::client] http1 handshake complete, spawning background dispatcher task
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::client] waiting for connection to be ready
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::client] connection is ready
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::pool] checkout dropped for ("https", identity.bitwarden.com)
[2026-02-21T15:27:47Z TRACE reqwest::retry] shouldn't retry!
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::pool] pool dropped, dropping pooled (("https", identity.bitwarden.com))
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::pool] checkout waiting for idle connection: ("https", identity.bitwarden.com)
[2026-02-21T15:27:47Z DEBUG reqwest::connect] starting new connection: https://identity.bitwarden.com/
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::connect::http] Http::connect; scheme=Some("https"), host=Some("identity.bitwarden.com"), port=None
[2026-02-21T15:27:47Z DEBUG hyper_util::client::legacy::connect::http] connecting to [2a04:4e42:4d::347]:443
[2026-02-21T15:27:47Z DEBUG hyper_util::client::legacy::connect::http] connected to [2a04:4e42:4d::347]:443
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::client] http1 handshake complete, spawning background dispatcher task
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::client] waiting for connection to be ready
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::client] connection is ready
[2026-02-21T15:27:47Z TRACE hyper_util::client::legacy::pool] checkout dropped for ("https", identity.bitwarden.com)
[2026-02-21T15:27:50Z TRACE reqwest::retry] shouldn't retry!
[2026-02-21T15:27:50Z WARN  rbw::api] unexpected error received during login: ConnectErrorRes { error: "device_error", error_description: Some("New device verification required"), error_model: Some(ConnectErrorResErrorModel { message: "new device verification required" }), two_factor_providers: None, sso_email_2fa_session_token: None }
[2026-02-21T15:27:50Z TRACE hyper_util::client::legacy::pool] put; add idle connection for ("https", identity.bitwarden.com)
[2026-02-21T15:27:50Z DEBUG hyper_util::client::legacy::pool] pooling idle connection for ("https", identity.bitwarden.com)
[2026-02-21T15:27:50Z TRACE hyper_util::client::legacy::pool] pool closed, canceling idle interval
[2026-02-21T15:27:50Z WARN  rbw_agent::sock] failed to log in to bitwarden instance: api request returned error: 400

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions