zed-industries/zed · error
snowflake sql api partition {} returned empty response body
Error message
snowflake sql api partition {} returned empty response body (http {}) What it means
Raised in the Snowflake partition fetch when the response body is empty. Status was already accepted (2xx or 202), so this is not an HTTP error: 202 with an empty body is the SQL API's 'statement still executing, no rows for this partition yet' state, and an empty 200 is abnormal. Because the code cannot distinguish 'not ready' from 'broken', it bails instead of returning an empty iterator that would silently drop a partition's rows.
Source
Thrown at crates/edit_prediction_cli/src/pull_examples.rs:426
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 {}): {}",
partition,
status.as_u16(),
body_preview
)
})
}
async fn fetch_partition_with_retries(View on GitHub (pinned to f4178619ac)
Solutions
- Retry the pull after a short delay — an empty-202 partition usually fills once the statement finishes
- If it persists, check the statement status in Snowflake (QUERY_HISTORY / the statement handle) to see whether it was aborted or failed
- Reduce the query's scope or increase the statement timeout so partitions complete before polling
Defensive patterns
Strategy: retry
Try / catch
// empty-202 means the statement is still executing: poll, don't fail
let mut backoff = 5;
loop {
match fetch_partition(partition).await {
Ok(body) => break body,
Err(e) if e.to_string().contains("empty response body") && backoff <= 80 => {
tokio::time::sleep(Duration::from_secs(backoff)).await;
backoff *= 2;
}
Err(e) => return Err(e),
}
} Prevention
- Expect empty-202 bodies while an async Snowflake statement is still running; poll with exponential backoff
- Never interpret an empty partition body as 'no rows' — this bail exists to prevent silent data loss
- Check QUERY_HISTORY if a partition stays empty across several polls; the statement may have been aborted
When it happens
Trigger: Polling a partition of a long-running async statement: Snowflake answers 202 with zero-length body while the partition is still being produced. Also possible on gateway hiccups that close the stream early with a 200.
Common situations: Impatient polling intervals on multi-minute Snowflake queries; statements near the statement-timeout limit where some partitions land and others come back empty-202.
Related errors
- snowflake sql api partition request http {}: {}
- snowflake sql api http {}: {}
- snowflake sql api timed out code={} message={}
- snowflake sql api returned error code={code} message={}
- sweep prompt {field_name} contains reserved tokens
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/a17952cc7264ec97.
Report an issue: GitHub.