zed-industries/zed · error

Import batches is only supported with batching client

Error message

Import batches is only supported with batching client

What it means

Thrown by AnthropicClient::import_batches when the client is the Plain (non-batching) variant. import_batches feeds externally-created Anthropic Batch API batch IDs into the client so pending results can be tracked and synced; a plain client has no batch machinery, so the operation is rejected. The symmetric sibling exists in the OpenAI client (error 227).

Source

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

            AnthropicClient::Batch(batching_llm_client) => batching_llm_client.sync_batches().await,
            AnthropicClient::Dummy => panic!("Dummy LLM client is not expected to be used"),
        }
    }

    pub fn pending_batch_count(&self) -> Result<usize> {
        match self {
            AnthropicClient::Plain(_) => Ok(0),
            AnthropicClient::Batch(batching_llm_client) => {
                batching_llm_client.pending_batch_count()
            }
            AnthropicClient::Dummy => panic!("Dummy LLM client is not expected to be used"),
        }
    }

    pub async fn import_batches(&self, batch_ids: &[String]) -> Result<()> {
        match self {
            AnthropicClient::Plain(_) => {
                anyhow::bail!("Import batches is only supported with batching client")
            }
            AnthropicClient::Batch(batching_llm_client) => {
                batching_llm_client.import_batches(batch_ids).await
            }
            AnthropicClient::Dummy => panic!("Dummy LLM client is not expected to be used"),
        }
    }
}

View on GitHub (pinned to f4178619ac)

Solutions

  1. Re-run with the batching provider/flag so the client is constructed as AnthropicClient::Batch
  2. Check pending_batch_count() (returns 0 for Plain) before attempting import_batches
  3. Verify the batch IDs belong to Anthropic's Batch API and you are not mixing them with the OpenAI client's IDs

Example fix

// before
client.import_batches(&batch_ids).await?; // Panics conceptually: Plain client

// after
if matches!(client, AnthropicClient::Batch(_)) {
    client.import_batches(&batch_ids).await?;
}
Defensive patterns

Strategy: type-guard

Validate before calling

let can_import = matches!(client, AnthropicClient::Batch(_))
    && client.pending_batch_count().map(|n| n >= 0).unwrap_or(false);

Type guard

fn is_batching(client: &AnthropicClient) -> bool {
    matches!(client, AnthropicClient::Batch(_))
}

Try / catch

if let Err(e) = client.import_batches(&batch_ids).await {
    if e.to_string().contains("only supported with batching client") {
        log::warn!("skipping import: client is not in batching mode");
    } else {
        return Err(e);
    }
}

Prevention

When it happens

Trigger: Running a CLI command/flag that calls import_batches(batch_ids) (e.g. resuming a batch-idempotency workflow) while the Anthropic client was constructed as AnthropicClient::Plain — i.e. a non-batching provider was selected. Note pending_batch_count() on Plain just returns 0 instead of failing.

Common situations: Resuming a long teacher-data-generation run by passing previously issued batch IDs (--import-batches style flags) but forgetting to also enable the batching client; provider flag typos that silently fall back to the non-batching variant.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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