databendlabs/databend · error

used for new executor

Error message

used for new executor

What it means

Panic in the legacy `QueryExecutorTasks::push_task` when given an `ExecutorTask::Async(_)` task. This legacy (queries) executor only handles sync and completed-async tasks; async task scheduling is handled exclusively by the new executor, so receiving an Async task here means the wrong executor implementation was selected for the query.

Solutions

  1. Ensure the query uses the new executor (check `flight` / executor settings such as enabling the new async executor) when the pipeline contains async-capable processors
  2. Audit pipeline construction so Async tasks are only produced when the new executor is active
  3. Return a descriptive error instead of `unreachable!()` to make the executor-selection mismatch diagnosable
  4. Compare with `queries_executor_tasks.rs::push_task` which supports the Async variant

Example fix

// before
ExecutorTask::Async(_) => unreachable!("used for new executor"),
// after
ExecutorTask::Async(_) => return Err(ErrorCode::Internal("Async task requires the new executor")),
Defensive patterns

Strategy: validation

Validate before calling

if matches!(task, ExecutorTask::Async(_)) && !use_new_executor { return Err(ErrorCode::Internal("async task requires new executor")); }

Type guard

fn supports_async(e: &dyn ExecutorTasks) -> bool { /* true only for QueriesExecutorTasks */ e.handles_async() }

Prevention

When it happens

Trigger: Calling `push_task` on the legacy query executor with an `ExecutorTask::Async` processor, typically when a query/pipeline that requires async scheduling is routed to the old executor path.

Common situations: Executor selection misconfiguration (e.g. query settings or feature flag choosing the old executor), or code changes that emit Async tasks without switching to the new executor.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/016783747156910a. Report an issue: GitHub.

Appendix: source

Thrown at src/query/service/src/pipelines/executor/query_executor_tasks.rs:294

        ExecutorTask::None
    }

    pub fn push_task(&mut self, worker_id: usize, task: ExecutorTask) {
        self.tasks_size += 1;
        debug_assert!(
            worker_id < self.workers_sync_tasks.len(),
            "out of index, {}, {}",
            worker_id,
            self.workers_sync_tasks.len()
        );
        let sync_queue = &mut self.workers_sync_tasks[worker_id];
        let completed_queue = &mut self.workers_completed_async_tasks[worker_id];

        match task {
            ExecutorTask::None => unreachable!(),
            ExecutorTask::Sync(processor) => sync_queue.push_back(processor),
            ExecutorTask::Async(_) => unreachable!("used for new executor"),
            ExecutorTask::AsyncCompleted(task) => completed_queue.push_back(task),
        }
    }
}

View on GitHub (pinned to 288d84d76e)