influxdata/influxdb · error · QueryExecutorError
error while executing plan
Error message
error while executing plan: {0} What it means
This error is a variant of QueryExecutorError in influxdb3's internal query executor. It wraps a DataFusion error raised while streaming results of an already-planned query. It fires after planning succeeded but the physical plan failed during execution (e.g. reading a table, evaluating expressions, or streaming batches).
Solutions
- Log the wrapped DataFusionError source (inspect err.source()) to get the underlying execution failure
- Verify the queried database and table data files are intact and readable by the server
- Re-run the query with a simpler form to isolate which expression/operator fails
- Pin or upgrade DataFusion/influxdb3 to a version where the execution bug is fixed
Example fix
// before
let batches = executor.execute(&plan).await?; // opaque failure
// after
let batches = executor.execute(&plan).await.map_err(|e| {
eprintln!("execute failed: {e}; source: {:?}", std::error::Error::source(&e));
e
})?; Defensive patterns
Strategy: try-catch
Validate before calling
// before executing
if !catalog.database_exists(db_name) {
return Err(format!("database {db_name} does not exist"));
} Type guard
fn is_execute_stream_err(e: &QueryExecutorError) -> Option<&DataFusionError> {
if let QueryExecutorError::ExecuteStream(df) = e { Some(df) } else { None }
} Try / catch
match executor.execute(&plan).await {
Ok(stream) => stream,
Err(QueryExecutorError::ExecuteStream(df)) => {
log::error!("plan execution failed: {df}");
return Err(QueryExecutorError::ExecuteStream(df));
}
Err(e) => return Err(e),
} Prevention
- Validate database and table names against the catalog before querying
- Keep data files healthy and monitor for segment/Parquet corruption
- Test queries after DataFusion version upgrades
- Log error chains (source()) to speed diagnosis
When it happens
Trigger: Calling the query executor's execute/stream method on a plan whose DataFusion execution fails mid-stream: partition/file open errors, schema mismatch at execution time, unsupported execution path, or an internal DataFusion panic converted to an error.
Common situations: Querying a database whose underlying Parquet/segment files are corrupted or missing; a DataFusion version upgrade changing plan behavior; querying with expressions valid at plan time but failing on actual data (e.g. casting invalid UTF-8 or overflow).
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- datafusion error
- Error computing AND
- Expected scalar value
- Unexpected err evaluating
- is not a valid data type, values are int64, uint64…
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/f07c4e94def6f70e.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_internal_api/src/query_executor.rs:29
use iox_query::{QueryDatabase, QueryNamespace};
use iox_query_influxql::show_databases::{InfluxQlShowDatabases, generate_metadata};
use iox_query_influxql::show_retention_policies::InfluxQlShowRetentionPolicies;
use iox_query_params::StatementParams;
use schema::INFLUXQL_MEASUREMENT_COLUMN_NAME;
use std::fmt::Debug;
use std::sync::Arc;
use trace::ctx::SpanContext;
use trace::span::{Span, SpanExt};
use trace_http::ctx::RequestLogContext;
use tracker::InstrumentedAsyncOwnedSemaphorePermit;
#[derive(Debug, thiserror::Error)]
pub enum QueryExecutorError {
#[error("database not found: {db_name}")]
DatabaseNotFound { db_name: String },
#[error("error while planning query: {0}")]
QueryPlanning(#[source] DataFusionError),
#[error("error while executing plan: {0}")]
ExecuteStream(#[source] DataFusionError),
#[error("unable to compose record batches from databases: {0}")]
DatabasesToRecordBatch(#[source] ArrowError),
#[error("unable to compose record batches from retention policies: {0}")]
RetentionPoliciesToRecordBatch(#[source] ArrowError),
#[error("invokded a method that is not implemented: {0}")]
MethodNotImplemented(&'static str),
#[error(transparent)]
Anyhow(#[from] anyhow::Error),
}
#[async_trait]
pub trait QueryExecutor: QueryDatabase + Debug + Send + Sync + 'static {
async fn get_db_namespace(
&self,
database_name: &str,
span_ctx: &Option<SpanContext>,
) -> Result<Arc<dyn QueryNamespace>, QueryExecutorError> {View on GitHub (pinned to 06200ef96b)