zed-industries/zed · error

Failed to retrieve batch {}: {:?}

Error message

Failed to retrieve batch {}: {:?}

What it means

import_batches calls anthropic::batches::retrieve_batch for each imported batch ID; this error wraps a failed retrieval (network or API error) and names the batch. The collab/eval CLI could not fetch the status of a previously submitted Anthropic batch.

Source

Thrown at crates/edit_prediction_cli/src/anthropic_client.rs:321

        let counts: Vec<i32> = connection.select(
            sql!(SELECT COUNT(*) FROM cache WHERE batch_id IS NOT NULL AND response IS NULL),
        )?()?;
        Ok(counts.into_iter().next().unwrap_or(0) as usize)
    }

    /// Import batch results from external batch IDs (useful for recovering after database loss)
    pub async fn import_batches(&self, batch_ids: &[String]) -> Result<()> {
        for batch_id in batch_ids {
            log::info!("Importing batch {}", batch_id);

            let batch_status = anthropic::batches::retrieve_batch(
                self.http_client.as_ref(),
                ANTHROPIC_API_URL,
                &self.api_key,
                batch_id,
            )
            .await
            .map_err(|e| anyhow::anyhow!("Failed to retrieve batch {}: {:?}", batch_id, e))?;

            log::info!(
                "Batch {} status: {}",
                batch_id,
                batch_status.processing_status
            );

            if batch_status.processing_status != "ended" {
                log::warn!(
                    "Batch {} is not finished (status: {}), skipping",
                    batch_id,
                    batch_status.processing_status
                );
                continue;
            }

            let results = anthropic::batches::retrieve_batch_results(
                self.http_client.as_ref(),

View on GitHub (pinned to f4178619ac)

Solutions

  1. Verify the batch ID exists and belongs to this account
  2. Check network/API status and retry the import
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/edit_prediction_cli/src/anthropic_client.rs:321 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/4c8c05f41275260b. Report an issue: GitHub.