{"record":{"id":"52ecabbe5a35eb66","repo":"jdx/mise","slug":"missing-arg-order-for","errorCode":null,"errorMessage":"missing arg order for {}","messagePattern":"missing arg order for (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_script_parser.rs","lineNumber":645,"sourceCode":"        if scripts_have_template {\n            for script in scripts {\n                if contains_template_syntax(script) {\n                    let _ = Self::render_script_with_context(&mut tera, script, &tera_ctx);\n                }\n            }\n        }\n        let mut cmd = usage::SpecCommand::default();\n        // TODO: ensure no gaps in args, e.g.: 1,2,3,4,5\n        let arg_order = arg_order.lock().unwrap();\n        cmd.args = input_args\n            .lock()\n            .unwrap()\n            .iter()\n            .cloned()\n            .sorted_by_key(|arg| {\n                arg_order\n                    .get(&arg.name)\n                    .unwrap_or_else(|| panic!(\"missing arg order for {}\", arg.name.as_str()))\n            })\n            .collect();\n        cmd.flags = input_flags.lock().unwrap().clone();\n\n        // Check for deprecated Tera template args usage\n        Self::check_tera_args_deprecation(&task.name, &cmd.args, &cmd.flags);\n\n        let mut spec = usage::Spec::default();\n        spec.cmd = cmd;\n        spec.merge(spec_from_field);\n\n        Ok(spec)\n    }\n\n    pub(super) async fn parse_run_scripts(\n        &self,\n        config: &Arc<Config>,\n        task: &Task,","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/task/task_script_parser.rs#L627-L663","documentation":"The companion assertion to the runtime-build panic: after the helper thread runs the OAuth future, `.join()` re-attaches it and asserts the thread did not panic. A JoinError here means the spawned thread died — most commonly because the inner `expect(\"failed to build tokio runtime\")` fired (resource exhaustion), or because the future itself panicked during GitHub OAuth (device flow / token refresh). The original panic is swallowed by the join, so this expect's message is what surfaces.","triggerScenarios":"Same conditions as the spawned-thread runtime-build failure (ENOMEM/EMFILE/thread-limit when building the current-thread runtime), or a panic inside the OAuth future running on the spawned thread while a tokio Handle is already current in the caller (mise invoked from inside another async process).","commonSituations":"Resource-starved CI runners and containers (low fd/thread/memory limits); invoking mise from within another tokio-based tool; mise OAuth code regressions that only panic when an ambient runtime exists.","solutions":["Free resources and retry — raise `ulimit -n`/`ulimit -u`, relax container pids/memory limits","Restart the mise daemon (`mise daemon stop`) to clear leaked fds/threads, then retry","Run with `RUST_BACKTRACE=1` — the swallowed inner panic usually still prints first and names the real cause","Update mise; if the inner panic is OAuth logic rather than resource exhaustion, report it with the trace"],"exampleFix":"# before\n$ mise use -g node   # panicked: tokio runtime thread panicked\n# after\n$ RUST_BACKTRACE=1 mise daemon stop; ulimit -n 4096; mise use -g node","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"mise_cmd() { RUST_BACKTRACE=1 mise \"$@\"; rc=$?; if [ $rc -ne 0 ] && [ $rc -lt 128 ]; then sleep 2; mise \"$@\"; else return $rc; fi; }  # one retry after freeing resources","preventionTips":["Raise fd/thread limits in the environment (ulimit, container pids-limit) rather than retrying repeatedly","Keep `RUST_BACKTRACE=1` in CI so the inner swallowed panic is visible","Avoid invoking mise from inside another tokio-based process; shell out via a clean subprocess"],"tags":["tokio","thread-join","github-oauth","panic","resource-exhaustion"],"backgroundTag":"thread-join-panic","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}