Skip to content

Random Issues With Fish Internal Commands Not Being Found #11921

Closed

Description

@thetinygoat

fish version: 4.1.1

OS: Darwin

Terminal:
Ghostty 1.2.1

Version

  • version: 1.2.1
  • channel: stable
    Build Config
  • Zig version : 0.14.1
  • build mode : builtin.OptimizeMode.ReleaseFast
  • app runtime : apprt.Runtime.none
  • font engine : font.main.Backend.coretext
  • renderer : renderer.generic.Renderer(renderer.Metal)
  • libxev : kqueue

I don't use any third party customizations

I have not been able to replicate the issue deterministically, it comes on randomly. This time it happened after i ran brew upgrade, and fish was one of the packages that was updated. I thought maybe it happened due to underlying files being changed.
But when i went through the update on my second machine which also has the same OS and terminal and same version was updated i didn't face the same issue, although i have faced the same issue on my second machine earlier.

It gets fixed when i open a new split or a new tab.

Here's the type of errors that i see when this happens.

fish: Unknown command: fish_job_summary
/opt/homebrew/Cellar/fish/4.1.1/share/fish/functions/__fish_print_pipestatus.fish (line 1): Unknown command: fish_status_to_signal
fish_status_to_signal $argv | string join "$sep"
^~~~~~~~~~~~~~~~~~~~^
in command substitution
        called on line 27 of file /opt/homebrew/Cellar/fish/4.1.1/share/fish/functions/__fish_print_pipestatus.fish
in function '__fish_print_pipestatus' with arguments '\[ \] \| \e\[31m \e\[31m\e\[1m 137'
        called on line 1 of file /opt/homebrew/Cellar/fish/4.1.1/share/fish/functions/fish_prompt.fish
in command substitution
        called on line 31 of file /opt/homebrew/Cellar/fish/4.1.1/share/fish/functions/fish_prompt.fish
in function 'fish_prompt'
in command substitution
/opt/homebrew/Cellar/fish/4.1.1/share/fish/functions/__fish_print_pipestatus.fish (line 27): Unknown command
        set -l last_pipestatus_string (fish_status_to_signal $argv | string join "$sep")
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '__fish_print_pipestatus' with arguments '\[ \] \| \e\[31m \e\[31m\e\[1m 137'
        called on line 1 of file /opt/homebrew/Cellar/fish/4.1.1/share/fish/functions/fish_prompt.fish
in command substitution
        called on line 31 of file /opt/homebrew/Cellar/fish/4.1.1/share/fish/functions/fish_prompt.fish
in function 'fish_prompt'
in command substitution
    __fish_seen_subcommand_from cache
    ^~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '__bat_cache_subcommand'
        called on line 70 of file /opt/homebrew/share/fish/vendor_completions.d/bat.fish
in function '__bat_cache_no_excl'
in command substitution
/opt/homebrew/share/fish/vendor_completions.d/bat.fish (line 54): Unknown command: __fish_seen_subcommand_from
    __fish_seen_subcommand_from cache
    ^~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '__bat_cache_subcommand'
in command substitution
/opt/homebrew/share/fish/vendor_completions.d/bat.fish (line 54): Unknown command: __fish_seen_subcommand_from
    __fish_seen_subcommand_from cache
    ^~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '__bat_cache_subcommand'
in command substitution
/opt/homebrew/share/fish/vendor_completions.d/bat.fish (line 54): Unknown command: __fish_seen_subcommand_from
    __fish_seen_subcommand_from cache
    ^~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '__bat_cache_subcommand'
        called on line 59 of file /opt/homebrew/share/fish/vendor_completions.d/bat.fish
in function '__bat_no_excl_args'
in command substitution
/opt/homebrew/share/fish/vendor_completions.d/bat.fish (line 59): Unknown command: __fish_seen_argument
    not __bat_cache_subcommand; and not __fish_seen_argument \
                                        ^~~~~~~~~~~~~~~~~~~^
in function '__bat_no_excl_args'
in command substitution
fish: Unknown command: __fish_is_first_arg
in command substitution
fish: Unknown command: __fish_seen_argument
in command substitution
fish: Unknown command: __fish_paste
fish: Unknown command: up-or-search
fish: Unknown command: down-or-search

Here's my config.fish file

# global variables
set -gx EDITOR nano
set -gx BUN_INSTALL ~/.bun
set -gx HISTSIZE 10000
set -gx SAVEHIST 10000
set -g fish_greeting

# path mutations
fish_add_path /opt/homebrew/bin
fish_add_path /opt/homebrew/opt/openjdk/bin
fish_add_path ~/.local/bin
fish_add_path ~/tools/kafka/bin
fish_add_path $BUN_INSTALL/bin

# abbrs
# git
abbr --add cat bat
abbr --add codex codex --search
abbr --add grep rg
abbr --add gst git status
abbr --add gr git remote -v
abbr --add gra git remote add
abbr --add grrm git remote remove
abbr --add gpl git pull
abbr --add gp git push
abbr --add glg git log --oneline
abbr --add gf git fetch
abbr --add gco git checkout
abbr --add gcl git clone
abbr --add gcb git checkout -b
abbr --add gc git commit -v
abbr --add gaa git add .
abbr --add gca git commit --amend
abbr --add gcane git commit --amend --no-edit
abbr --add gsh git stash
abbr --add gshp git stash pop
abbr --add gb git branch

# fish
abbr --add reload source ~/.config/fish/config.fish

Activity

  1. krobelus commented on Oct 9, 2025

    @krobelus
    Contributor
  2. thetinygoat commented on Oct 9, 2025

    @thetinygoat
    Author

    does it only happen to shells that are running while you upgrade the shell?
    That would be a known issue.

    Can u elaborate a bit on what you mean?

  3. Darkshadow2 commented on Oct 9, 2025

    @Darkshadow2
    Contributor

    The new version of fish may have changed function definitions or names of functions, and the old running versions of fish aren't going to magically pick those up. If the old versions try to load a function that doesn't exist in the new version, you'll get these kinds of errors.

    It's best when installing a new version of fish to quit any other running instances, and immediately after the upgrade do exec fish -l/-i (-l for a login shell, -i for an interactive shell, your choice on that one). The exec line will replace the currently running version with the one just installed.

  4. krobelus commented on Oct 10, 2025

    @krobelus
    Contributor
  5. thetinygoat commented on Oct 10, 2025

    @thetinygoat
    Author

    Thanks for the response! looking forward to the fix! should i close the issue or leave it open?

  6. krobelus commented on Oct 13, 2025

    @krobelus
    Contributor
  7. added 5 commits that reference this issue on Oct 27, 2025
    5e63f9f
    5dafc23
    ecffb79
    9162cd9
    1854c50
  8. added a commit that references this issue on Nov 1, 2025
    0709e4b
  9. Berrysoft commented on Nov 17, 2025

    @Berrysoft
    Contributor

    @krobelus I found this issue through git blame. I understand that why you added embed-data feature into the CMake build system, but it produces HUGE binaries, from ~2MB to ~12MB. It's OK if you insist, but could you consider using symlinks in CMake instead of building three executables? Then we will have one large binary instead of three (actually two large binaries and one small binary).

  10. krobelus commented on Nov 17, 2025

    @krobelus
    Contributor

    Yes, replacing them with symlinks (or hardlinks?) is definitely something we should do ASAP (especially as some of these binaries include redundant translations).
    I'm not sure what's the situation with symlinks on MSYS2 but we can at least do it everywhere else.
    (We can also make fish_indent a script that effectively does exec ${0#_indent} -c 'fish_indent ...', since it's a builtin now.)

    I don't insist on the exact behavior we have today; the main motivation was to embed internal helper functions,
    so this type of issue doesn't happen again.
    There are other things such as completions and translations where we do have a graceful fallback should they change or missing or go missing, so we might not need to pack them into the binary.

    There are probably other things we can do for reducing binary size, we haven't spent much time on that.
    I think a substantial part of the binary size comes from translations, there has been some research into potentially compressing them.

  11. Berrysoft commented on Nov 17, 2025

    @Berrysoft
    Contributor

    I'm not sure what's the situation with symlinks on MSYS2 but we can at least do it everywhere else.

    Both symlinks and hardlinks work on MSYS2. It's better to use hardlinks, since symlinks sometimes require Administrator privilege.

  12. krobelus commented on Nov 17, 2025

    @krobelus
    Contributor

    Hardlinks seem reasonable for a start. Though "trampoline" scripts would make it more obvious that the disk space is only used once.
    Hardlinks are probably not commonly used outside build systems (for caching) and maybe Git.
    Now the extra bin targets only exist for cargo install.

    diff --git a/CMakeLists.txt b/CMakeLists.txt
    index 764ed19a33..78bb0037fd 100644
    --- a/CMakeLists.txt
    +++ b/CMakeLists.txt
    @@ -84,11 +84,20 @@
     # Define fish.
     create_target(fish)
     
    +function(CREATE_LINK target)
    +  add_custom_target(
    +    ${target} ALL
    +    DEPENDS fish
    +    COMMAND ln -f fish ${target}
    +    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    +  )
    +endfunction(CREATE_LINK)
    +
     # Define fish_indent.
    -create_target(fish_indent)
    +create_link(fish_indent)
     
     # Define fish_key_reader.
    -create_target(fish_key_reader)
    +create_link(fish_key_reader)
     
     # Set up tests.
     include(cmake/Tests.cmake)
    diff --git a/cmake/Install.cmake b/cmake/Install.cmake
    index bb5543a619..8e9f96ccf0 100644
    --- a/cmake/Install.cmake
    +++ b/cmake/Install.cmake
    @@ -1,7 +1,5 @@
     set(CMAKE_INSTALL_MESSAGE NEVER)
     
    -set(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fish ${CMAKE_CURRENT_BINARY_DIR}/fish_indent ${CMAKE_CURRENT_BINARY_DIR}/fish_key_reader)
    -
     set(prefix ${CMAKE_INSTALL_PREFIX})
     set(bindir ${CMAKE_INSTALL_BINDIR})
     set(sysconfdir ${CMAKE_INSTALL_SYSCONFDIR})
    @@ -75,11 +73,19 @@
       endforeach()
     endfunction(FISH_TRY_CREATE_DIRS)
     
    -install(PROGRAMS ${PROGRAMS}
    +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fish
             PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
                         GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
             DESTINATION ${bindir})
     
    +if(NOT IS_ABSOLUTE ${bindir})
    +  set(abs_bindir "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${bindir}")
    +else()
    +  set(abs_bindir "\$ENV{DESTDIR}${bindir}")
    +endif()
    +install(CODE "file(CREATE_LINK ${abs_bindir}/fish ${abs_bindir}/fish_indent)")
    +install(CODE "file(CREATE_LINK ${abs_bindir}/fish ${abs_bindir}/fish_key_reader)")
    +
     fish_create_dirs(${sysconfdir}/fish/conf.d ${sysconfdir}/fish/completions
         ${sysconfdir}/fish/functions)
     install(FILES etc/config.fish DESTINATION ${sysconfdir}/fish/)
  13. krobelus commented on Nov 19, 2025

    @krobelus
    Contributor

    Pushed the hardlink change.

    Dumping some remaining findings.

    Half of the size is embedded data files:

    $ cargo b --release
    $ du -h target/release/fish
    15M     target/release/fish
    
    $ cargo b --release --no-default-features --features=localize-messages
    $ du -h target/release/fish
    7.6M	target/release/fish
    

    Their size mostly comes from completions and man pages.
    We could compress them and probably save a lot.
    I don't know who uses compression like that (except Linux)

    $ cargo b --release && target/release/fish -c '
    for dir in (status list-files | string match -r "^[^/]*" | sort -u)
    	echo (  for file in (status list-files $dir)
    			status get-file $file
    		end | wc -c) $dir
    end | sort -rn | numfmt --to=iec-i
    '
    3.9Mi completions
    2.2Mi man
    431Ki functions
    318Ki tools
    

    Translations are currently 2MiB:

    $ cargo b --release --no-default-features
    $ du -h target/release/fish
    5.6M	target/release/fish
    
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions