{"record":{"id":"508ed8f41defbe5f","repo":"jdx/mise","slug":"task-executor-initialized","errorCode":null,"errorMessage":"task executor initialized","messagePattern":"task executor initialized","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/run.rs","lineNumber":902,"sourceCode":"        let tasks = self.prepare_tasks(&config, tasks).await?;\n        let num_tasks = tasks.all().count();\n\n        // Step 2: Setup output handler and validate tasks\n        self.setup_output_and_validate(&tasks)?;\n        self.output = Some(self.output(None));\n\n        // Step 3: Install tools needed by tasks\n        if !self.skip_tools {\n            self.install_task_tools(&mut config, &tasks, &previewed_tools)\n                .await?;\n        }\n\n        // Step 4: Create TaskExecutor after tool installation\n        self.setup_executor()?;\n\n        // Validate every scheduled invocation before starting the scheduler so\n        // an invalid parent or dependency cannot run any task commands first.\n        let executor = self.executor.as_ref().expect(\"task executor initialized\");\n        for task in tasks.all() {\n            executor\n                .preflight_task_usage(&config, task)\n                .await\n                .wrap_err_with(|| format!(\"failed to validate task {}\", task.name))?;\n        }\n\n        // Disable exit-on-ctrl-c so tasks can handle SIGINT gracefully\n        ctrlc::exit_on_ctrl_c(false);\n\n        let timer = std::time::Instant::now();\n        let this = Arc::new(self);\n        let config = config.clone();\n\n        // Step 5: Initialize scheduler and run tasks\n        let mut scheduler = crate::task::task_scheduler::Scheduler::new(this.jobs());\n        let main_deps = Arc::new(Mutex::new(tasks));\n","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/run.rs#L884-L920","documentation":"This panic is an internal invariant check in mise's task runner. After tool installation completes, `setup_executor()` must have populated `self.executor`; `parallelize_tasks` then unwraps it to run preflight validation on every scheduled task. If the executor is `None` at this point, a refactoring or ordering bug in the run pipeline has occurred — users cannot trigger it via normal CLI input.","triggerScenarios":"Only reachable if `setup_executor()` silently succeeds without setting `self.executor`, or if code is reordered so `parallelize_tasks` runs before `setup_executor()`. Also triggered if a developer bypasses the standard `run` pipeline (e.g. a new entry point calling `parallelize_tasks` directly).","commonSituations":"Seen during development of mise itself: someone adds a code path that returns early from setup with `Ok(())` while skipping executor assignment, or a contributor moves the preflight loop before executor creation.","solutions":["Re-run the same mise command with `MISE_DEBUG=1` to capture the stack trace and file a mise bug report with the command and trace","Check that no local mise wrapper, shim, or patched build is running stale or modified code; rebuild with `mise run build`","Inspect `setup_executor()` in src/cli/run.rs to confirm it assigns `self.executor` on every success path","Upgrade to the latest mise release in case this was a regression already fixed upstream"],"exampleFix":"// before\nlet executor = self.executor.as_ref().expect(\"task executor initialized\");\n// after\nlet Some(executor) = self.executor.as_ref() else {\n    bail!(\"internal error: task executor was not initialized; please report this bug\");\n};","handlingStrategy":"validation","validationCode":"if std::env::var(\"MISE_DEBUG\").is_ok() { eprintln!(\"repro: mise run <task>\"); }\n// For plugin/CI authors: assert the binary is unmodified\n// cargo build && target/debug/mise run <task>  # compare against released mise","typeGuard":null,"tryCatchPattern":"// Panic, not Result: catch it only to improve the report\nlet output = std::process::Command::new(\"mise\").args([\"run\", \"build\"]).output()?;\nif !output.status.success() && String::from_utf8_lossy(&output.stderr).contains(\"task executor initialized\") {\n    eprintln!(\"mise internal bug — file an issue with MISE_DEBUG=1 output\");\n}","preventionTips":["Never bypass the standard `mise run` pipeline with custom entry points","Keep executor setup and use in the same command implementation","Report any occurrence with a debug trace; it always indicates a mise bug"],"tags":["rust","panic","internal-invariant","task-runner"],"backgroundTag":"internal-invariant-violation","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}