9

When I try to navigate directories using the cd command, it takes way too a long time. And terminal suggests creating a config file to increase the timeout. Once my terminal hanged, I mean when I tried to execute the command, the cursor kept blinking but nothing was happening and even ctrl+c had no effect I had to reboot. But the slow terminal still persists. I have observed that this delay problem occurs only for the cd command.

~ on ☁️  (us-east-2) 
❯ cd Cloud/
[WARN] - (starship::utils): Executing command "/usr/bin/git" timed out.
[WARN] - (starship::utils): You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing.

Cloud on  main on ☁️ (us-east-2) ❯

  • 1
    Which terminal suggests that, how? You probably have something in your Bash prompt which takes time, but you aren't showing us your configuration, and we can't guess. – tripleee Mar 21 '22 at 05:27
  • bash terminal, how do I show my configuration, any commands, please? – Nishant Kumar Mar 21 '22 at 05:30
  • 1
    Probably find anything related to PS1 and/or prompt_command in your .bash_profile or .bashrc (or any files included by those) and include in your question. – tripleee Mar 21 '22 at 05:31
  • The warning message already reveals that your error message comes from git (though please don't post pictures of text). – tripleee Mar 21 '22 at 05:32
  • Looks like the actual configuration you need help with is from Starship; probably update your question to indicate this. – tripleee Mar 21 '22 at 05:33
  • Probably something specific to the Cloud directory causes git to take a long time. Have you checked out a remote repository which is no longer accessible into that directory? – tripleee Mar 21 '22 at 05:34
  • Yes, its definitely, you need to check your system bashrc file as per the command output there is something call from bashrc or bash_profile. – Brijesh Sondarva Mar 21 '22 at 06:28
  • 3
    Was this ever solved? I having kinda the same problem. – He Nrik May 10 '22 at 18:32
  • @HeNrik I uninstalled starship and reinstalled it. Did several times, and tried setting everything to default. That didn't work either. Finally, I uninstalled starship permanently which solved my problem for good. To customize my terminal I started using zsh instead of bash. I installed "Oh my zsh". I'm happier now rather than relying on the starship. – Nishant Kumar May 10 '22 at 22:37
  • @HeNrik. I have just solve it. Take a look to my answer below – A.Casanova Jul 26 '23 at 10:27

4 Answers4

6

The message was clear, you just needed to set a timeout:

Inside ~/.config/starship.toml (create it if it doesn't exist) you could set the timeout like this:

command_timeout = 10000

And then update or reinstalling the starship:

sh -c "$(curl -fsSL https://starship.rs/install.sh)"
void
  • 191
  • I tried. That didn't work either. And why would I expect to wait for too long for just a directory navigation command? I'm using ZSH instead of bash now and for the theme, I'm using powerlevel10k which is giving an ultra-smooth user experience. – Nishant Kumar May 24 '22 at 17:41
  • Well, I had exactly same problem and the solution worked for me! I knew that the question is old enough, I put my solution here not for you! but for others for anyone else who may face same problem. – void May 24 '22 at 20:25
  • 1
    LOL, "why would I expect to wait for too long" - I said that in the context of time being taken for the navigation for which I have to allot 10000, not because you answered a very old question. In fact, I truly appreciate your efforts in putting an answer here which indeed is helpful to many people out there. Please don't get me wrong, I am grateful for your efforts. Why not me bro? I said I tried your answer :) please don't exclude me :) I never expected my previous comment would turn out to mean in that way LOL :) My apologies, if it did for you :) – Nishant Kumar May 24 '22 at 21:41
  • :) You are welcome bro. I am sorry if I got you wrong – void May 25 '22 at 09:35
  • 1
    I thought I could put command_timeout = 10000 at the end of the toml file. But it gave an error: [WARN] - (starship::config): Error in 'Character' at 'command_timeout': Unknown key. Using the command starship config command_timeout 1000 helped me fix it. – raf Mar 30 '24 at 06:29
6

I had the same problem. Using this command, starship config command_timeout 1000, helped me fix it.

Source: https://github.com/starship/starship/discussions/4181#discussioncomment-3170845

1

Starship executes different commands to get information to display in the prompt, for example the version of a program or the current git status. To make sure starship doesn't hang while trying to execute these commands we set a time limit, if a command takes longer than this limit starship will stop the execution of the command and output the above warning, this is expected behaviour.

This time limit is configurable using the command_timeout key; you can increase the time limit. You can also follow the debugging steps below to see which command is being slow and see if you can optimise it. Finally you can set the STARSHIP_LOG env var to error to hide these warnings.

This issue happens in really big git repos, if the repository is too big, you cannot afford the timeout, you can skip the warnings with:

In your ~/.config/starship.toml:

# Set whatever time out in ms.
command_timeout = 500

In your ~/.zshrc:

# Launch Starship theme
export STARSHIP_LOG="error"
eval "$(starship init zsh)"
avpaderno
  • 297
0

I'm on a mac and I fixed this by reinstalling xcode with homebrew. I ran the command

brew install xcode

and it fixed my issue.

LoganN
  • 1