jdx/mise · error

executor must be initialized before running tasks

Error message

executor must be initialized before running tasks

What it means

`run_task_sched` forwards each scheduled task to the `TaskExecutor`, which `run` creates during setup. The `.expect()` panics if `self.executor` is `None`, meaning the scheduler is being driven without the initialization step that `run` performs. This is a programming-invariant guard, not a user-facing error.

Solutions

  1. Run `MISE_DEBUG=1 mise <cmd>` and report the panic with the trace to the mise repository
  2. Ensure your command flows through the normal `Run` command implementation rather than hand-building the runner
  3. Call `setup_executor()` before any scheduling in custom code paths
  4. Update to the latest mise version to rule out a fixed regression

Example fix

// before
self.executor.as_ref().expect("executor must be initialized before running tasks").run_task_sched(ctx).await
// after
let executor = self.executor.as_ref()
    .ok_or_else(|| eyre!("internal error: executor not initialized"))?;
executor.run_task_sched(ctx).await
Defensive patterns

Strategy: validation

Validate before calling

// Before scripting around mise, verify the command works normally:
mise run --dry-run <task> || echo "scheduler path broken; update mise"

Prevention

When it happens

Trigger: Invoking the scheduler callback `run_task_sched` from a code path that never called `setup_executor()`; constructing the runner struct manually in tests or new commands without initialization; an early-return bug in setup that still lets scheduling begin.

Common situations: Contributors adding a new subcommand that reuses the task scheduler but forgets the executor setup step; test harnesses constructing the runner directly.

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 jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/c8dbb02ef2d0d6ef. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/run.rs:1376

                .executor
                .as_ref()
                .map(|e| e.is_interrupted())
                .unwrap_or(false)
    }

    fn mark_interrupted(&self) {
        if let Some(executor) = &self.executor {
            executor.mark_interrupted();
        }
    }

    async fn run_task_sched(
        &self,
        ctx: TaskRunContext<'_>,
    ) -> Result<crate::task::task_executor::TaskRunOutcome> {
        self.executor
            .as_ref()
            .expect("executor must be initialized before running tasks")
            .run_task_sched(ctx)
            .await
    }

    fn add_failed_task(&self, task: Task, status: Option<i32>) {
        if let Some(executor) = &self.executor {
            executor.add_failed_task(task, status);
        }
    }

    fn validate_task(&self, task: &Task) -> Result<()> {
        use crate::file;
        use crate::ui;
        if self.task_cache.enabled() && task.cache.as_ref().is_some_and(|cache| cache.enabled) {
            Settings::get().ensure_experimental("task artifact caching")?;
        }
        if task.rust_cache.as_ref().is_some_and(|cache| cache.enabled) {
            deprecated_at!(

View on GitHub (pinned to afd2eddd3a)