{"record":{"id":"d4e000cb80bb8a24","repo":"jdx/mise","slug":"loads-completions-eagerly-so-mise-cannot-leave","errorCode":null,"errorMessage":"{} loads completions eagerly, so mise cannot leave it a stub; redirect `mise completion {} --tool {tool}` yourself","messagePattern":"(.+?) loads completions eagerly, so mise cannot leave it a stub; redirect `mise completion (.+?) --tool (.+?)` yourself","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/packslip.rs","lineNumber":1463,"sourceCode":"    if ($global:{loader}_busy) {{ return }}\n    $global:{loader}_busy = $true\n    try {{\n        $__mise_script = @(& mise completion powershell --tool '{tool}' 2>$null) -join \"`n\"\n        if ($__mise_script) {{\n            Invoke-Expression $__mise_script\n            $__mise_cursor = $cursorPosition - $commandAst.Extent.StartOffset\n            $__mise_line = $commandAst.Extent.Text.PadRight([Math]::Max($commandAst.Extent.Text.Length, $__mise_cursor))\n            (TabExpansion2 -inputScript $__mise_line -cursorColumn $__mise_cursor).CompletionMatches\n        }}\n    }} finally {{\n        Register-ArgumentCompleter -Native -CommandName '{tool}' -ScriptBlock $function:{loader}\n        $global:{loader}_busy = $false\n    }}\n}}\nRegister-ArgumentCompleter -Native -CommandName '{tool}' -ScriptBlock $function:{loader}\n\"#\n        ),\n        _ => bail!(\n            \"{} loads completions eagerly, so mise cannot leave it a stub; redirect `mise completion {} --tool {tool}` yourself\",\n            shell.as_str(),\n            shell.as_str()\n        ),\n    };\n    Ok(stub)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn statement_with(resources: &str) -> Statement {\n        let json = format!(\n            r#\"{{\"_type\":\"https://in-toto.io/Statement/v1\",\"subject\":[{{\"name\":\"t-linux-x64.tar.xz\",\"digest\":{{\"sha256\":\"{a}\"}}}},{{\"name\":\"t-skill.tar.gz\",\"digest\":{{\"sha256\":\"{b}\"}}}}],\"predicateType\":\"https://packslip.dev/release/v1\",\"predicate\":{{\"project\":\"github.com/o/r\",\"version\":\"1.0.0\",\"published_at\":\"2026-09-01T00:00:00Z\",\"source\":{{\"repo\":\"https://github.com/o/r\",\"commit\":\"{c}\"}},\"artifacts\":[{{\"name\":\"t-linux-x64.tar.xz\",\"os\":\"linux\",\"arch\":\"x86_64\",\"libc\":\"gnu\",\"size\":5,\"format\":\"tar.xz\",\"bin\":[\"t\",\"u\"]}}],\"resources\":{resources},\"identity\":{{\"scheme\":\"sigstore-oidc\",\"key_id\":\"https://github.com/o/r/.github/workflows/r.yml@refs/tags/v1\",\"issuer\":\"https://token.actions.githubusercontent.com\"}}}}}}\"#,\n            a = \"a\".repeat(64),\n            b = \"b\".repeat(64),\n            c = \"c\".repeat(40),","sourceCodeStart":1445,"sourceCodeEnd":1481,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/packslip.rs#L1445-L1481","documentation":"mise installs stub completion loaders that generate the real completion lazily on first tab-press, but only for shells it knows how to defer for (bash, zsh, fish, PowerShell). For any other shell, no lazy stub is possible because the shell would load completions eagerly, so stub() bails telling the user to wire the redirect themselves via `mise completion <shell> --tool <tool>`.","triggerScenarios":"Activation or stub installation for a shell outside the supported set (anything other than bash, zsh, fish, pwsh) reaching the `_ => bail!` arm of the stub builder — e.g. an elvish, nushell, or unknown shell identifier.","commonSituations":"Using mise shims/activation under an exotic shell; a misconfigured $SHELL or MISE_SHELL value; automation invoking stub generation with an unsupported shell string.","solutions":["Use a supported shell (bash, zsh, fish, or PowerShell) for mise-managed lazy completions.","For another shell, generate the script yourself with `mise completion <shell> --tool <tool>` and source it in that shell's config.","Check that MISE_SHELL / the detected shell name is spelled correctly (e.g. \"pwsh\", not \"powershell\")."],"exampleFix":"// before (nushell activation stub attempt)\nmise activate nu\n// after\neval (mise completion nu --tool mytool | save -f completions.nu); source completions.nu","handlingStrategy":"validation","validationCode":"const SUPPORTED: [&str; 4] = [\"bash\", \"zsh\", \"fish\", \"pwsh\"];\nif !SUPPORTED.contains(&shell) { eprintln!(\"{shell}: no lazy stub; source `mise completion {shell} --tool <tool>` manually\"); }","typeGuard":"fn stubbable(shell: &str) -> bool { matches!(shell, \"bash\" | \"zsh\" | \"fish\" | \"pwsh\") }","tryCatchPattern":"match stub(shell, tool) {\n    Ok(s) => write_stub(s),\n    Err(e) if e.to_string().contains(\"loads completions eagerly\") => {\n        let script = completion_script(&config, tool, shell)?;\n        write_eager_loader(script);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Only rely on mise stubs for bash, zsh, fish, and pwsh.","For other shells, generate and source completions manually via `mise completion <shell> --tool <tool>`.","Correct any MISE_SHELL / $SHELL misconfiguration (e.g. \"powershell\" vs \"pwsh\")."],"tags":["completions","shells","stub","unsupported-shell"],"backgroundTag":"unsupported-platform","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}