zed-industries/zed · error

snowflake sql api partition request http {}: {}

Error message

snowflake sql api partition request http {}: {}

What it means

Raised while fetching one partition of a Snowflake SQL API result (pull_examples.rs): after the async request completes, a status that is neither 2xx nor 202 (Accepted, the SQL API's 'statement still executing' signal) is fatal. The body is decompressed from gzip first when the content-encoding says so, then the raw status code and lossy-UTF-8 body text are embedded in the error so the Snowflake error envelope (code/message) is visible.

Source

Thrown at crates/edit_prediction_cli/src/pull_examples.rs:418

            .await
            .context("failed to read Snowflake SQL API partition response body")?;
        bytes
    };

    let body_bytes = if content_encoding.as_deref() == Some("gzip") {
        let mut decoder = GzDecoder::new(&body_bytes[..]);
        let mut decompressed = Vec::new();
        decoder
            .read_to_end(&mut decompressed)
            .context("failed to decompress gzip response")?;
        decompressed
    } else {
        body_bytes
    };

    if !status.is_success() && status.as_u16() != 202 {
        let body_text = String::from_utf8_lossy(&body_bytes);
        anyhow::bail!(
            "snowflake sql api partition request http {}: {}",
            status.as_u16(),
            body_text
        );
    }

    if body_bytes.is_empty() {
        anyhow::bail!(
            "snowflake sql api partition {} returned empty response body (http {})",
            partition,
            status.as_u16()
        );
    }

    serde_json::from_slice::<SnowflakeStatementResponse>(&body_bytes).with_context(|| {
        let body_preview = String::from_utf8_lossy(&body_bytes[..body_bytes.len().min(500)]);
        format!(
            "failed to parse Snowflake SQL API partition {} response JSON (http {}): {}",

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check the embedded status/body: 401/403 -> refresh Snowflake credentials and re-run; 400 -> the partition handle or statement may be stale, re-issue the query
  2. Re-run the pull: the flow is resumable per example/partition, so transient 5xx/503 usually clear on retry
  3. For very large pulls, reduce partition size or query scope so individual partition requests finish quickly
Defensive patterns

Strategy: retry

Try / catch

match fetch_partition(partition).await {
    Err(e) if is_transient_snowflake_http(&e) => {
        tokio::time::sleep(Duration::from_secs(30)).await;
        fetch_partition(partition).await?
    }
    Err(e) if e.to_string().contains("http 40") => {
        anyhow::bail!("credentials/partition handle problem, refresh auth: {e:#}")
    }
    other => other?,
}

Prevention

When it happens

Trigger: Partitioned fetch of a large result set where one partition request returns 400 (bad request/malformed partition handle), 401/403 (expired token or missing privileges on the warehouse/database), or 5xx. Distinct from the sibling 'timed out' error: a timeout-shaped response body with code 000630 is classified separately at the outer request level.

Common situations: Long ETL-style example pulls where the OAuth/session token expires mid-pagination; Snowflake incidents returning 503; partition handles invalidated by the statement being aborted.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/aec829ea989e00b9. Report an issue: GitHub.