wasmerio/wasmer · error

Not logged in registry {host_str}

Error message

Not logged in registry {host_str}

What it means

The `wasmer whoami` command queries the registry's `current_user` and this error is thrown when the query succeeds but returns no user, i.e. the stored credentials do not identify a logged-in user. The CLI uses the unauthenticated-capable client and relies on the backend to report identity, so a missing/expired token surfaces as this message.

Source

Thrown at lib/cli/src/commands/auth/whoami.rs:25

#[derive(Debug, Parser)]
/// Print the current user and where is logged into
pub struct Whoami {
    #[clap(flatten)]
    env: WasmerEnv,
}

#[async_trait::async_trait]
impl AsyncCliCommand for Whoami {
    type Output = ();

    /// Execute `wasmer whoami`
    async fn run_async(self) -> Result<Self::Output, anyhow::Error> {
        let client = self.env.client_unauthennticated()?;
        let host_str = self.env.registry_public_url()?.host_str().unwrap().bold();
        let user = wasmer_backend_api::query::current_user(&client)
            .await?
            .ok_or_else(|| anyhow::anyhow!("Not logged in registry {host_str}"))?;
        println!(
            "Logged into registry {host_str} as user {}",
            user.username.bold()
        );
        Ok(())
    }
}

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Run `wasmer login` to obtain a fresh token for the configured registry.
  2. Verify the registry host configured matches the one you logged into (`wasmer config get registry`).
  3. Inspect ~/.wasmer/wasmer.toml for a missing/blank token and re-login if absent.
  4. If you believe you are logged in, re-login to refresh an expired token rather than assuming server issues.

Example fix

// before
wasmer whoami  // Error: Not logged in registry registry.wasmer.io
// after
wasmer login
wasmer whoami
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check auth before calling whoami programmatically
let client = env.client_unauthennticated()?;
let user = wasmer_backend_api::query::current_user(&client).await?;
if user.is_none() {
    eprintln!("Run `wasmer login` first");
}

Type guard

fn has_user(u: &Option<wasmer_backend_api::wg::WalrusQueryCurrentCurrentUserCurrent_user>) -> bool {
    u.is_some()
}

Try / catch

match whoami().await {
    Err(e) if e.to_string().contains("Not logged in registry") => {
        eprintln!("No active session; run `wasmer login`");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running `wasmer whoami` while `current_user(&client)` resolves to `Ok(None)` — typically when no token is stored, or the stored token is expired/revoked for the configured registry host.

Common situations: Fresh machine or CI runner with no `wasmer login`; token expired after backend session TTL; switching between registries where login exists only on one; auth backend outage returning an empty user.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/0181d1fcba501161. Report an issue: GitHub.