clockworklabs/SpacetimeDB · error · anyhow::Error

Response data is missing.

Error message

Response data is missing.

What it means

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).

Source

Thrown at crates/cli/src/subcommands/login.rs:191

    #[serde(rename = "sessionToken")]
    session_token: Option<String>,
}

#[derive(Clone, Deserialize)]
struct WebLoginSessionResponseApproved {
    session_token: String,
}

impl WebLoginSessionResponse {
    fn approved(self) -> anyhow::Result<Option<WebLoginSessionResponseApproved>> {
        if !self.success {
            return Err(anyhow::anyhow!(self
                .error
                .clone()
                .unwrap_or("Unknown error".to_string())));
        }

        let data = self.data.ok_or(anyhow::anyhow!("Response data is missing."))?;
        if !data.approved {
            // Approved is false, no session token expected
            return Ok(None);
        }

        let session_token = data
            .session_token
            .ok_or(anyhow::anyhow!("Session token is missing in response.".to_string()))?;
        Ok(Some(WebLoginSessionResponseApproved {
            session_token: session_token.clone(),
        }))
    }
}

async fn web_login(remote: &Url, open_browser: bool) -> Result<String, anyhow::Error> {
    let client = reqwest::Client::new();

    let response: WebLoginTokenResponse = client

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Retry the login flow once
  2. Update the CLI and server to matching versions
  3. Probe the endpoint with curl to confirm responses include the data object
  4. If the mismatch persists, capture the response body and report it to SpacetimeDB
Defensive patterns

Strategy: try-catch

Try / catch

let out = Command::new("spacetime").args(["login"]).output()?;
let stderr = String::from_utf8_lossy(&out.stderr);
if !out.status.success() && stderr.contains("data is missing") {
    // schema mismatch: version skew between CLI and server — update and retry
}

Prevention

When it happens

Trigger: `spacetime login` session polling receiving {"success": true} with the data field missing or null.

Common situations: 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.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/4b6040da691fb204. Report an issue: GitHub.