{"record":{"id":"73dd2b79d978a205","repo":"clockworklabs/SpacetimeDB","slug":"unknown-error","errorCode":null,"errorMessage":"Unknown error","messagePattern":"Unknown error","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/login.rs","lineNumber":185,"sourceCode":"}\n\n#[derive(Clone, Deserialize)]\nstruct WebLoginSessionData {\n    approved: bool,\n\n    #[serde(rename = \"sessionToken\")]\n    session_token: Option<String>,\n}\n\n#[derive(Clone, Deserialize)]\nstruct WebLoginSessionResponseApproved {\n    session_token: String,\n}\n\nimpl WebLoginSessionResponse {\n    fn approved(self) -> anyhow::Result<Option<WebLoginSessionResponseApproved>> {\n        if !self.success {\n            return Err(anyhow::anyhow!(self\n                .error\n                .clone()\n                .unwrap_or(\"Unknown error\".to_string())));\n        }\n\n        let data = self.data.ok_or(anyhow::anyhow!(\"Response data is missing.\"))?;\n        if !data.approved {\n            // Approved is false, no session token expected\n            return Ok(None);\n        }\n\n        let session_token = data\n            .session_token\n            .ok_or(anyhow::anyhow!(\"Session token is missing in response.\".to_string()))?;\n        Ok(Some(WebLoginSessionResponseApproved {\n            session_token: session_token.clone(),\n        }))\n    }","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/login.rs#L167-L203","documentation":"During `spacetime login`, the CLI polls the auth server's session endpoint and expects {success, data{approved, sessionToken}}. If the server replies success=false without an error string, the CLI has no reason to surface and falls back to the literal 'Unknown error' placeholder (login.rs:185).","triggerScenarios":"`spacetime login` where the session-polling endpoint returns a body like {\"success\": false} with the error field omitted or null.","commonSituations":"Auth server outage or bug; a proxy/gateway rewriting or truncating responses; CLI/server version mismatch; self-hosted node whose auth component is misconfigured.","solutions":["Retry `spacetime login` once — transient server-side rejections are common","Verify the server is healthy and that --server points to the intended host","Update the spacetimedb CLI (`spacetime update`) so CLI and server versions match","If self-hosting, check the auth endpoints respond with the documented JSON shape"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for i in 1 2 3; do\n  spacetime login && break\n  echo \"login attempt $i failed; retrying\" >&2; sleep $((i * 2))\ndone","preventionTips":["Retry web login once before investigating","Keep CLI and server versions aligned","Check server health before reporting auth errors"],"tags":["login","auth","server-error","web-login"],"backgroundTag":"auth-server-error","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}