influxdata/influxdb · error · QueryEndpointError::Fail
Cannot query: (query: )
Error message
Cannot query: {err} (query: {query}) What it means
QueryEndpointError::Fail wraps an underlying error plus the offending query string, formatted as 'Cannot query: {err} (query: {query})'. It is the error variant of the async QueryEndpoint trait, meaning a query execution failed for an implementation-defined reason. The wrapped err and echoed query identify the exact failure.
Solutions
- Read the wrapped err and echoed query to locate the failing SQL and cause.
- Validate the SQL against the actual schema (table/column names) before executing.
- Handle the error in the endpoint consumer (retry transient failures, abort or skip on permanent SQL errors).
Defensive patterns
Strategy: try-catch
Try / catch
match endpoint.query(q).await {
Ok(res) => ...,
Err(QueryEndpointError::Fail { err, query }) => {
eprintln!("query failed: {err} (query: {query})");
}
} Prevention
- Validate SQL table/column names against the live schema before executing.
- Log the echoed query string on failure for fast diagnosis.
- Distinguish transient vs permanent query errors for retry policy.
When it happens
Trigger: Calling query() on a QueryEndpoint implementation when execution fails: invalid SQL, missing table, engine error — anything the implementation wraps into Fail { err, query }.
Common situations: Typo'd table or field names in plugin queries; queries run before the table exists; SQL syntax unsupported by the embedded engine.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- datafusion error
- datafusion error
- error while planning query
- invlid UTF8 received from server
- queries not supported in compactor only mode
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/5601d35c5333d46a.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_py_api/src/query.rs:8
use arrow_array::RecordBatch;
use async_trait::async_trait;
use std::collections::HashMap;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum QueryEndpointError {
#[error("Cannot query: {err} (query: {query})")]
Fail {
err: Box<dyn std::error::Error + Send + Sync>,
query: String,
},
}
#[async_trait]
pub trait QueryEndpoint: std::fmt::Debug + Send + Sync + 'static {
async fn query(
&self,
db: &str,
query: &str,
params: &HashMap<String, String>,
) -> Result<Vec<RecordBatch>, QueryEndpointError>;
}
View on GitHub (pinned to 06200ef96b)