influxdata/influxdb · warning · Error
The operation was cancelled
Error message
The operation was cancelled: {0} What it means
`Error::Cancelled` is one of the typed client errors mapping a gRPC `CANCELLED` status: "The operation was cancelled: {0}". It is returned when the operation was cancelled, typically by the client itself or by the server shutting down / shedding work, with the wrapped `ServerError` carrying the server's message.
Solutions
- Retry the operation if the cancellation was transient (e.g. server restart); use idempotent requests and bounded retries with backoff.
- Check whether your own code (timeout wrappers, `abort()`, dropping futures) cancelled the call and adjust.
- Verify server health/uptime; during shutdowns wait or reconnect to a healthy node.
- Match on `Error::Cancelled` explicitly to distinguish cancellation from other failures and choose retry vs abort accordingly.
Example fix
// before
let res = client.query(req).await?; // aborted on shutdown
// after
let res = match client.query(req).await {
Err(Error::Cancelled(se)) if is_retryable(&se) => {
tokio::time::sleep(Duration::from_millis(200)).await;
client.query(req).await?
}
other => other?,
}; Defensive patterns
Strategy: retry
Try / catch
match result {
Err(Error::Cancelled(_)) => retry_with_backoff(op, max_retries = 3),
other => other,
} Prevention
- Avoid wrapping client calls in abort-prone timeout/selection constructs without retry
- Drain in-flight requests gracefully during shutdown before dropping the runtime
- Use bounded retries with exponential backoff for cancelled idempotent operations
When it happens
Trigger: A gRPC call through the IOx client returning status `CANCELLED` — e.g. the caller dropped/cancelled the future mid-request, a deadline or shutdown cancelled the call, or the server explicitly cancelled the operation.
Common situations: Application shutdown or tokio runtime teardown while requests are in flight; timeouts implemented via `tokio::time::timeout` dropping futures; server restarts or overload causing work cancellation; users aborting long-running queries.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- {message}
- An unexpected error occurred in the client library
- Internal error
- lost HTTP/gRPC service
- Operation is not implemented or supported
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/c96c4ebad13bd4e8.
Report an issue: GitHub.
Appendix: source
Thrown at core/influxdb_iox_client/src/client/error.rs:66
}
impl ServerErrorDetails for NotFound {
fn try_decode(status: &Status) -> Option<Self> {
generated_types::google::decode_not_found(status).next()
}
}
impl ServerErrorDetails for PreconditionViolation {
fn try_decode(status: &Status) -> Option<Self> {
generated_types::google::decode_precondition_violation(status).next()
}
}
/// The errors returned by this client
#[derive(Error, Debug)]
#[expect(missing_docs)]
pub enum Error {
#[error("The operation was cancelled: {0}")]
Cancelled(ServerError<()>),
#[error("Unknown server error: {0}")]
Unknown(ServerError<()>),
#[error("Client specified an invalid argument: {0}")]
InvalidArgument(Box<ServerError<FieldViolation>>),
#[error("Deadline expired before operation could complete: {0}")]
DeadlineExceeded(ServerError<()>),
#[error("{0}")]
NotFound(Box<ServerError<NotFound>>),
#[error("Some entity that we attempted to create already exists: {0}")]
AlreadyExists(Box<ServerError<AlreadyExists>>),
#[error("The caller does not have permission to execute the specified operation: {0}")]View on GitHub (pinned to 06200ef96b)