How to fix "bash: __vte_prompt_command: command not found..." when using tmux?

When I launch TMUX, I get this error message every time I enter a command.

bash: __vte_prompt_command: command not found...

For example,

$ tmux --help
usage: tmux [-2CDlNuvV] [-c shell-command] [-f file] [-L socket-name]
            [-S socket-path] [-T features] [command [flags]]
bash: __vte_prompt_command: command not found...
$ man tmux
bash: __vte_prompt_command: command not found...
$ tmux -V
tmux 3.2a
bash: __vte_prompt_command: command not found...

But after deleting ~/.bashrc this issue is not there. I think there is an issue with fedoras default ~/.bashrc file.

These are the contents of ~/.bashrc present in my system.

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
        for rc in ~/.bashrc.d/*; do
                if [ -f "$rc" ]; then
                        . "$rc"
                fi
        done
fi

unset rc

For now I am not going to use the default ~/.bashrc that comes with the installation as a temporary fix.

OS: Fedora Linux 35 (Workstation Edition) x86_64 
Kernel: 5.14.14-300.fc35.x86_64 
Shell: bash 5.1.8 
DE: GNOME 41.0 
Tmux Version: tmux 3.2a

https://bugs.archlinux.org/task/36170

1 Like

I have added following code to ~/.bashrc which solves bug for me

# check if function exists and define empty one if doesn't
if [[ $(type -t "__vte_prompt_command") != function ]]; then
    function __vte_prompt_command(){
        return 0
    }
fi
2 Likes

Hi, @jmlich This solution works. But could not find out what caused it in the first place. Thanks for helping me out.

The function is defined in file “/etc/profile.d/vte.sh”. VTE is a widget used by gnome-terminal, xterm, tmux and others. Since “gnome-terminal” is the default, I assume you have used it sometime and not received the error. That means “tmux” or your tmux configuration is the culprit. I would just re-install tmux or search through your config file.
Additional info, “which vte” → /usr/bin/vte and rpm -qi vte.