jdx/mise · error

{} loads completions eagerly, so mise cannot leave it a stub

Error message

{} loads completions eagerly, so mise cannot leave it a stub; redirect `mise completion {} --tool {tool}` yourself

What it means

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>`.

Source

Thrown at src/packslip.rs:1463

    if ($global:{loader}_busy) {{ return }}
    $global:{loader}_busy = $true
    try {{
        $__mise_script = @(& mise completion powershell --tool '{tool}' 2>$null) -join "`n"
        if ($__mise_script) {{
            Invoke-Expression $__mise_script
            $__mise_cursor = $cursorPosition - $commandAst.Extent.StartOffset
            $__mise_line = $commandAst.Extent.Text.PadRight([Math]::Max($commandAst.Extent.Text.Length, $__mise_cursor))
            (TabExpansion2 -inputScript $__mise_line -cursorColumn $__mise_cursor).CompletionMatches
        }}
    }} finally {{
        Register-ArgumentCompleter -Native -CommandName '{tool}' -ScriptBlock $function:{loader}
        $global:{loader}_busy = $false
    }}
}}
Register-ArgumentCompleter -Native -CommandName '{tool}' -ScriptBlock $function:{loader}
"#
        ),
        _ => bail!(
            "{} loads completions eagerly, so mise cannot leave it a stub; redirect `mise completion {} --tool {tool}` yourself",
            shell.as_str(),
            shell.as_str()
        ),
    };
    Ok(stub)
}

#[cfg(test)]
mod tests {
    use super::*;

    fn statement_with(resources: &str) -> Statement {
        let json = format!(
            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"}}}}}}"#,
            a = "a".repeat(64),
            b = "b".repeat(64),
            c = "c".repeat(40),

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Use a supported shell (bash, zsh, fish, or PowerShell) for mise-managed lazy completions.
  2. For another shell, generate the script yourself with `mise completion <shell> --tool <tool>` and source it in that shell's config.
  3. Check that MISE_SHELL / the detected shell name is spelled correctly (e.g. "pwsh", not "powershell").

Example fix

// before (nushell activation stub attempt)
mise activate nu
// after
eval (mise completion nu --tool mytool | save -f completions.nu); source completions.nu
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: [&str; 4] = ["bash", "zsh", "fish", "pwsh"];
if !SUPPORTED.contains(&shell) { eprintln!("{shell}: no lazy stub; source `mise completion {shell} --tool <tool>` manually"); }

Type guard

fn stubbable(shell: &str) -> bool { matches!(shell, "bash" | "zsh" | "fish" | "pwsh") }

Try / catch

match stub(shell, tool) {
    Ok(s) => write_stub(s),
    Err(e) if e.to_string().contains("loads completions eagerly") => {
        let script = completion_script(&config, tool, shell)?;
        write_eager_loader(script);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: Using mise shims/activation under an exotic shell; a misconfigured $SHELL or MISE_SHELL value; automation invoking stub generation with an unsupported shell string.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/d4e000cb80bb8a24. Report an issue: GitHub.