{"record":{"id":"114d0913e2fa1e42","repo":"wasmerio/wasmer","slug":"not-logged-into-registry-host-str","errorCode":null,"errorMessage":"Not logged into registry {host_str}","messagePattern":"Not logged into registry (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/cli/src/commands/auth/logout.rs","lineNumber":40,"sourceCode":"\n#[async_trait::async_trait]\nimpl AsyncCliCommand for Logout {\n    type Output = ();\n\n    async fn run_async(self) -> Result<Self::Output, anyhow::Error> {\n        let registry = self.env.registry_endpoint()?.to_string();\n        let host_str = self\n            .env\n            .registry_public_url()\n            .map_err(|_| anyhow::anyhow!(\"No registry not specified!\"))?\n            .host_str()\n            .unwrap()\n            .bold();\n\n        let client = self\n            .env\n            .client()\n            .map_err(|_| anyhow::anyhow!(\"Not logged into registry {host_str}\"))?;\n\n        let user = wasmer_backend_api::query::current_user(&client)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Not logged into registry {host_str}: {e}\"))?\n            .ok_or_else(|| anyhow::anyhow!(\"Not logged into registry {host_str}\"))?;\n\n        let theme = dialoguer::theme::ColorfulTheme::default();\n        let prompt = dialoguer::Confirm::with_theme(&theme).with_prompt(format!(\n            \"Log user {} out of registry {host_str}?\",\n            user.username\n        ));\n\n        if prompt.interact()? || self.non_interactive {\n            let mut config = self.env.config()?;\n            let token = config\n                .registry\n                .get_login_token_for_registry(&registry)\n                .unwrap();","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/commands/auth/logout.rs#L22-L58","documentation":"`wasmer logout` needs an authenticated client for the registry to identify the current user. If `env.client()` fails — meaning there is no stored login token for this registry — the CLI raises `Not logged into registry {host_str}`. The same message is reused when the `current_user` query succeeds but returns no user.","triggerScenarios":"`wasmer logout` when no token is stored for the registry host (env.client() errors), or `current_user(&client)` returns `None` despite a client being constructible.","commonSituations":"Running logout without ever having logged in; logging out of registry A while the token is stored for registry B; cleared ~/.wasmer dir removing the stored token; expired token that backend rejects as anonymous.","solutions":["Log in first: `wasmer login` (or `wasmer login <TOKEN>`), then retry logout.","Confirm you are targeting the registry you actually logged into (`wasmer config get-registry`).","Check ~/.wasmer/wasmer.toml for a login token entry for {host_str}.","If already logged out, no action is needed — this error just indicates there is nothing to log out of."],"exampleFix":"// before\n$ wasmer logout  # never logged in\n// error: Not logged into registry registry.wasmer.io\n// after\n$ wasmer login\n$ wasmer logout","handlingStrategy":"validation","validationCode":"# check for a stored token before attempting logout\n[ -n \"$(grep 'token' ~/.wasmer/wasmer.toml 2>/dev/null)\" ] || { \n  echo \"not logged in - logout not needed\"; \n  exit 0; \n}","typeGuard":null,"tryCatchPattern":"// treat 'Not logged into registry' as an idempotent no-op in scripts\nif wasmer logout 2>&1 | grep -q 'Not logged into registry'; then\n  echo \"already logged out; continuing\"\nfi","preventionTips":["Make logout idempotent in scripts: tolerate 'not logged in' outcomes.","Check `wasmer whoami` before logout to confirm an active session.","Ensure the target registry matches the one you logged into."],"tags":["auth","logout","registry","session"],"backgroundTag":"not-logged-in","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}