{"record":{"id":"4b6040da691fb204","repo":"clockworklabs/SpacetimeDB","slug":"response-data-is-missing","errorCode":null,"errorMessage":"Response data is missing.","messagePattern":"Response data is missing\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/login.rs","lineNumber":191,"sourceCode":"    #[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    }\n}\n\nasync fn web_login(remote: &Url, open_browser: bool) -> Result<String, anyhow::Error> {\n    let client = reqwest::Client::new();\n\n    let response: WebLoginTokenResponse = client","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/login.rs#L173-L209","documentation":"The login session response had success=true but no data object. The protocol requires data to be present on success (it carries approved/sessionToken), so the CLI treats its absence as a schema violation and fails the login (login.rs:191).","triggerScenarios":"`spacetime login` session polling receiving {\"success\": true} with the data field missing or null.","commonSituations":"CLI/server version skew after upgrading one side; an API gateway stripping response fields; a custom or incompatible auth front-end in front of the node.","solutions":["Retry the login flow once","Update the CLI and server to matching versions","Probe the endpoint with curl to confirm responses include the data object","If the mismatch persists, capture the response body and report it to SpacetimeDB"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let out = Command::new(\"spacetime\").args([\"login\"]).output()?;\nlet stderr = String::from_utf8_lossy(&out.stderr);\nif !out.status.success() && stderr.contains(\"data is missing\") {\n    // schema mismatch: version skew between CLI and server — update and retry\n}","preventionTips":["Upgrade CLI and server together","Probe auth endpoints with curl when self-hosting","Report persistent schema mismatches with the response body"],"tags":["login","auth","schema-mismatch","web-login"],"backgroundTag":"auth-response-schema-mismatch","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}