zed-industries/zed · error
Failed to upload batch file: {:?}
Error message
Failed to upload batch file: {:?} What it means
upload_pending_requests uploads the assembled JSONL file to OpenAI before creating the batch; this error wraps a failed upload call. The batch payload could not be stored on the files endpoint (auth, quota, or network).
Source
Thrown at crates/edit_prediction_cli/src/openai_client.rs:537
let custom_id = format!("req_hash_{}", hash);
let batch_item = batches::BatchRequestItem::new(custom_id, request);
let line = batch_item
.to_jsonl_line()
.map_err(|e| anyhow::anyhow!("Failed to serialize batch item: {:?}", e))?;
jsonl_content.push_str(&line);
jsonl_content.push('\n');
}
let filename = format!("batch_{}.jsonl", chrono::Utc::now().timestamp());
let file_obj = batches::upload_batch_file(
self.http_client.as_ref(),
OPEN_AI_API_URL,
&self.api_key,
&filename,
jsonl_content.into_bytes(),
)
.await
.map_err(|e| anyhow::anyhow!("Failed to upload batch file: {:?}", e))?;
let batch = batches::create_batch(
self.http_client.as_ref(),
OPEN_AI_API_URL,
&self.api_key,
batches::CreateBatchRequest::new(file_obj.id),
)
.await
.map_err(|e| anyhow::anyhow!("Failed to create batch: {:?}", e))?;
{
let connection = self.connection.lock().unwrap();
connection.with_savepoint("batch_upload", || {
let q = sql!(UPDATE openai_cache SET batch_id = ? WHERE request_hash = ?);
let mut exec = connection.exec_bound::<(&str, &str)>(q)?;
for hash in &request_hashes {
exec((batch.id.as_str(), hash.as_str()))?;
}View on GitHub (pinned to f4178619ac)
Solutions
- Check the wrapped error for auth/quota causes
- Retry the upload on transient network failures
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/edit_prediction_cli/src/openai_client.rs:537 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/171207643652711e.
Report an issue: GitHub.