zed-industries/zed · error
snowflake sql api http {}: {}
Error message
snowflake sql api http {}: {} What it means
Generic non-2xx failure from the Snowflake SQL API request path (pull_examples.rs): unlike the partition variant (error 231), this one first parses the body into SnowflakeStatementResponse and exempts timeout-shaped responses (code 000630 with 'timeout' in the message — handled as error 234) as well as 202. Any other failing status bails here with the status code and body text, which for Snowflake typically contains a JSON envelope with 'code' and 'message' describing the exact server-side error.
Source
Thrown at crates/edit_prediction_cli/src/pull_examples.rs:541
let status = response.status();
let body_bytes = {
use futures::AsyncReadExt as _;
let mut body = response.into_body();
let mut bytes = Vec::new();
body.read_to_end(&mut bytes)
.await
.context("failed to read Snowflake SQL API response body")?;
bytes
};
let snowflake_response = serde_json::from_slice::<SnowflakeStatementResponse>(&body_bytes)
.context("failed to parse Snowflake SQL API response JSON")?;
if !status.is_success() && status.as_u16() != 202 && !is_timeout_response(&snowflake_response) {
let body_text = String::from_utf8_lossy(&body_bytes);
anyhow::bail!("snowflake sql api http {}: {}", status.as_u16(), body_text);
}
if is_timeout_response(&snowflake_response) {
anyhow::bail!(
"snowflake sql api timed out code={} message={}",
snowflake_response.code.as_deref().unwrap_or("<no code>"),
snowflake_response
.message
.as_deref()
.unwrap_or("<no message>")
);
}
Ok(snowflake_response)
}
pub async fn fetch_rejected_examples_after(
http_client: Arc<dyn HttpClient>,View on GitHub (pinned to f4178619ac)
Solutions
- Read the embedded Snowflake code/message in {body} — it names the real cause (e.g. does not exist or not authorized)
- Re-authenticate/refresh credentials and confirm the role has privileges on the warehouse, database, and schema
- For 429/5xx, retry with backoff; for 400, fix the SQL or request payload
Defensive patterns
Strategy: retry
Try / catch
match execute_statement(&client, request).await {
Err(e) if is_transient_snowflake_http(&e) => {
tokio::time::sleep(Duration::from_secs(30)).await;
execute_statement(&client, request).await?
}
Err(e) => {
// body embeds Snowflake's code/message envelope; surface it for diagnosis
anyhow::bail!("Snowflake SQL API failure: {e:#}")
}
ok => ok?,
} Prevention
- The body text names the real Snowflake error — always read it before retrying
- Distinguish 4xx (fix credentials/SQL/privileges) from 5xx/429 (retry with backoff)
- Timeout-shaped bodies are already classified separately (code 000630) — size the query to avoid them
When it happens
Trigger: Submitting/executing the examples query: 400 for malformed SQL or invalid request parameters, 401 when the auth token expired, 403 for missing role/warehouse privileges, 404 for an unknown statement handle, 429/5xx under load. The message is the catch-all for everything that is not 'accepted' and not a timeout.
Common situations: Token expiry during multi-hour pulls; role changes removing USAGE on the warehouse; Snowflake regional incidents; SQL referencing a table renamed after a schema migration.
Related errors
- snowflake sql api partition request http {}: {}
- snowflake sql api partition {} returned empty response body
- snowflake sql api timed out code={} message={}
- snowflake sql api returned error code={code} message={}
- Baseten API returned {status}: {body}
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/3174f4f65fe16c80.
Report an issue: GitHub.