nautechsystems/nautilus_trader · error
KrakenHttpError (cloned per-order batch failure)
Error message
KrakenHttpError (cloned per-order batch failure)
What it means
Same pattern as the Kraken Futures client: in the Kraken Spot batch submit path, if a batch HTTP call fails, every order in that batch receives a clone of the KrakenHttpError, and every later batch is marked NotAttempted before breaking out of the loop.
Source
Thrown at crates/adapters/kraken/src/http/spot/client.rs:2838
// AddOrderBatch returns result items in request order, so exact cardinality makes
// positional correlation unambiguous.
Ok(response) if response.orders.len() == batch.len() => {
for ((idx, _), order) in batch.iter().zip(response.orders) {
results[*idx] = Some(Ok(order));
}
}
Ok(response) => {
for (idx, _) in batch {
results[*idx] = Some(Err(KrakenBatchOrderError::ResponseCount {
expected: batch.len(),
actual: response.orders.len(),
}
.into()));
}
}
Err(e) => {
for (idx, _) in batch {
results[*idx] = Some(Err(anyhow::Error::new(e.clone())));
}
for later_batch in &batches[batch_index + 1..] {
for (idx, _) in later_batch {
results[*idx] = Some(Err(KrakenBatchOrderError::NotAttempted.into()));
}
}
break;
}
}
}
results
.into_iter()
.map(|result| result.unwrap_or_else(|| Err(KrakenBatchOrderError::NotAttempted.into())))
.collect()
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Unwrap the cloned KrakenHttpError to read status code and message.
- Retry failed and NotAttempted batches with exponential backoff, respecting Retry-After on 429.
- Validate API credentials and endpoint permissions up front.
- Keep batch sizes small so a single failure doesn't mark many orders NotAttempted.
Example fix
// before
let results = client.submit_orders_batch(orders).await; // later batches NotAttempted after one failure
// after
for batch in orders.chunks(15) { match client.submit_orders_batch(batch.to_vec()).await { /* per-batch retry */ } } Defensive patterns
Strategy: retry
Validate before calling
// ensure each batch is within Kraken spot limits before send assert!(batch.len() <= MAX_BATCH_SIZE);
Try / catch
for r in client.submit_orders_batch(orders).await {
if let Err(e) = r {
if !format!("{e}").contains("NotAttempted") { /* retry with backoff */ }
}
} Prevention
- Split large submissions into small independent batches
- Use idempotent client order ids so retries are safe
- Respect rate limits; back off on 429
- Pre-validate credentials and order parameters
When it happens
Trigger: submit_orders_batch() where inner.submit_orders_batch(batch) returns Err — HTTP/network failure, auth rejection, or rate limit on Kraken Spot's batch order endpoint.
Common situations: Burst order submission during outages or rate-limit windows, invalid/expired API keys, or connectivity loss between the client and Kraken Spot.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- KrakenHttpError (cloned per-order batch failure)
- Kraken Spot does not support the demo environment
- Modify order failed: {e}
- Either client_order_id or venue_order_id is required
- Trailing stop orders are not yet supported on the Kraken WS
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/0c0a0dd45cc5b3fa.
Report an issue: GitHub.