{"record":{"id":"3251bc7e644ce10a","repo":"clockworklabs/SpacetimeDB","slug":"status","errorCode":null,"errorMessage":"{status}","messagePattern":"\\{status\\}","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dev.rs","lineNumber":1386,"sourceCode":"    database_identity: &str,\n    auth_header: &crate::util::AuthHeader,\n    prefix: Option<&str>,\n) -> Result<(), anyhow::Error> {\n    let client = reqwest::Client::new();\n    let builder = client.get(format!(\"{host_url}/v1/database/{database_identity}/logs\"));\n    let builder = add_auth_header_opt(builder, auth_header);\n    let res = builder.query(&[(\"num_lines\", \"10\"), (\"follow\", \"true\")]).send().await?;\n\n    let status = res.status();\n    if status.is_client_error() || status.is_server_error() {\n        let mut err = res.text().await?;\n        // The server doesn't always send an error description in the response\n        // body (maybe it should), so default to status code + canonical reason\n        // phrase (e.g. \"502 Bad Gateway\").\n        if err.is_empty() {\n            err = format!(\"{status}\");\n        }\n        anyhow::bail!(err)\n    }\n\n    let term_color = if std::io::stdout().is_terminal() {\n        termcolor::ColorChoice::Auto\n    } else {\n        termcolor::ColorChoice::Never\n    };\n\n    let mut rdr = res.bytes_stream().map_err(std::io::Error::other).into_async_read();\n    let mut line = String::new();\n    while rdr.read_line(&mut line).await? != 0 {\n        let record = serde_json::from_str::<LogRecord<'_>>(&line)?;\n        let out = termcolor::StandardStream::stdout(term_color);\n        let mut out = out.lock();\n        format_log_record(&mut out, &record, prefix)?;\n        drop(out);\n        line.clear();\n    }","sourceCodeStart":1368,"sourceCodeEnd":1404,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/3653d2ed498fddbd83b7062aa6bf8970e18635ec/crates/cli/src/subcommands/dev.rs#L1368-L1404","documentation":"`spacetime logs --follow` (and the log stream inside `spacetime dev`) performs an HTTP GET on the logs endpoint with num_lines=10&follow=true. When the server answers 4xx/5xx and sends no error body, the CLI bails with only the status line, e.g. `404 Not Found` or `502 Bad Gateway`. The bare status is your only clue; map it to the usual HTTP semantics.","triggerScenarios":"Following logs for a database name or identity that is not published (404); missing/expired credentials on a hosted server (401/403); the server restarting or still booting; a proxy in front of the server returning 502/504; a server version too old to support follow streaming.","commonSituations":"Typo in the database name or using the publish name vs the generated `spacetime init` name with a random suffix; not logged in (`spacetime login`) before hitting main.spacetimedb.com; local `spacetime start` still initializing; corporate proxies buffering or killing SSE-style streams.","solutions":["List what actually exists: `spacetime list`, then retry with the exact database name","Authenticate: `spacetime login` (hosted) or check `--server http://localhost:3000` points at a running local node","Retry once the server is up; check `spacetime server ping` first","Drop `--follow` to see whether the non-streaming log request works, isolating proxy/stream issues","If behind a proxy, bypass it for the SpacetimeDB host or disable response buffering"],"exampleFix":"# before\nspacetime logs mydb --follow -s https://testnet.spacetimedb.com\n# after\nspacetime list -s https://testnet.spacetimedb.com\nspacetime logs my-real-db --follow -s https://testnet.spacetimedb.com","handlingStrategy":"validation","validationCode":"# confirm the db exists and you are authenticated before following logs\nspacetime list -s \"$SERVER\" | grep -q \"^$DB\" && spacetime logs \"$DB\" --follow -s \"$SERVER\"","typeGuard":null,"tryCatchPattern":"if let Err(e) = logs_follow(&db).await {\n    let msg = e.to_string();\n    if msg.contains(\"401\") || msg.contains(\"403\") { /* re-login */ }\n    else if msg.contains(\"404\") { /* wrong db name */ }\n    else if msg.contains(\"50\") { /* server/proxy issue: retry after backoff */ }\n}","preventionTips":["Always pass the exact database name from `spacetime list`","Run `spacetime login` and `spacetime server ping` before long log-follow sessions","Avoid HTTP proxies that buffer streaming responses for the SpacetimeDB host"],"tags":["http","logs","network","auth","spacetime-dev"],"backgroundTag":"http-error-status","analyzedSha":"3653d2ed498fddbd83b7062aa6bf8970e18635ec","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}