{"record":{"id":"0181d1fcba501161","repo":"wasmerio/wasmer","slug":"not-logged-in-registry-host-str","errorCode":null,"errorMessage":"Not logged in registry {host_str}","messagePattern":"Not logged in registry (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/cli/src/commands/auth/whoami.rs","lineNumber":25,"sourceCode":"\n#[derive(Debug, Parser)]\n/// Print the current user and where is logged into\npub struct Whoami {\n    #[clap(flatten)]\n    env: WasmerEnv,\n}\n\n#[async_trait::async_trait]\nimpl AsyncCliCommand for Whoami {\n    type Output = ();\n\n    /// Execute `wasmer whoami`\n    async fn run_async(self) -> Result<Self::Output, anyhow::Error> {\n        let client = self.env.client_unauthennticated()?;\n        let host_str = self.env.registry_public_url()?.host_str().unwrap().bold();\n        let user = wasmer_backend_api::query::current_user(&client)\n            .await?\n            .ok_or_else(|| anyhow::anyhow!(\"Not logged in registry {host_str}\"))?;\n        println!(\n            \"Logged into registry {host_str} as user {}\",\n            user.username.bold()\n        );\n        Ok(())\n    }\n}\n","sourceCodeStart":7,"sourceCodeEnd":33,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/commands/auth/whoami.rs#L7-L33","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `wasmer login` to obtain a fresh token for the configured registry.","Verify the registry host configured matches the one you logged into (`wasmer config get registry`).","Inspect ~/.wasmer/wasmer.toml for a missing/blank token and re-login if absent.","If you believe you are logged in, re-login to refresh an expired token rather than assuming server issues."],"exampleFix":"// before\nwasmer whoami  // Error: Not logged in registry registry.wasmer.io\n// after\nwasmer login\nwasmer whoami","handlingStrategy":"try-catch","validationCode":"// pre-check auth before calling whoami programmatically\nlet client = env.client_unauthennticated()?;\nlet user = wasmer_backend_api::query::current_user(&client).await?;\nif user.is_none() {\n    eprintln!(\"Run `wasmer login` first\");\n}","typeGuard":"fn has_user(u: &Option<wasmer_backend_api::wg::WalrusQueryCurrentCurrentUserCurrent_user>) -> bool {\n    u.is_some()\n}","tryCatchPattern":"match whoami().await {\n    Err(e) if e.to_string().contains(\"Not logged in registry\") => {\n        eprintln!(\"No active session; run `wasmer login`\");\n    }\n    other => other?,\n}","preventionTips":["Check `wasmer whoami` in CI startup scripts before registry operations.","Automate `wasmer login` with a token when a session is missing.","Keep tokens refreshed; expired tokens surface as this error."],"tags":["cli","authentication","registry"],"backgroundTag":"not-logged-into-registry","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}