Skip to content

Shell completion after unexpected word messes up the prompt #596

Description

@dhanak

When I attempt to perform shell completion after an unexpected word in an argument with mise, the verbose error message from usage messes up the shell prompt.

For example:

$ mise help <tab>Error:   × unexpected word: help

mise

After pressing typing mise help and pressing tab, a multi-row error message is printed, and the prompt, including the current input, becomes garbled and overwritten. This makes it really hard to figure out what's already typed and what's new.

Activity

  1. added a commit that references this issue on Jun 1, 2026
    120df1b
  2. dhanak commented on Jul 8, 2026

    @dhanak
    Author

    I see that the attempted fix has been rejected because it silences potentially important and informative error messages. I understand that, but it doesn't make the issue itself less annoying. I wonder: could the solution be to adjust the mise completion script and make it swallow usage stderr output instead?

    I.e., the last line of the following block:

            do
                    local -a parts=("${(@ps:\t:)line}") 
                    values+=("${parts[1]}") 
                    descs+=("${parts[2]}") 
                    inserts+=("${parts[3]}") 
                    [[ "${parts[3]}" == "'"* ]] && needs_menu=1 
            done < <(command usage complete-word --shell zsh -f "$spec_file" -- "${(Q)words[@]}")

    could be changed to:

            done < <(command usage complete-word --shell zsh -f "$spec_file" -- "${(Q)words[@]}" 2>/dev/null)

    WDYT? This would allow anyone to debug the usage script itself by invoking the appropriate completion command manually (i.e., the error message would be printed on the console), but it would also fix this issue:

    $ usage complete-word --shell zsh -f /tmp/usage__usage_spec_mise_2026_7_2.spec -- mise help ""
    Error:   × unexpected word: help
    

    Update:

    Just confirming, that using this in .zshrc works fine:

    source <(mise completion zsh | awk '/command usage/ { gsub(")$", " 2>/dev/null)"); }; { print $0; }')
  3. added a commit that references this issue on Sep 24, 2026
    da27391
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions