Exit Code 3 error

Basically I’m getting Exit code 3 error, If I re-run the job with ssh and I follow the same steps I’m able to proceed with the flow. Any idea?

1 Like

Hi Jarv1193,

Welcome to the community!

Could you please elaborate more about the issue and paste complete error. You can check about exit codes here.

Regards,
Pawan Bahuguna

1 Like

Hi Pawan,
Basically I have this configuration on my config.yml

After the install nvm I can’t use any command because I got exit code error: “3”

Could you please provide link to your failed and passed build.

I have exactly the same problem installing NVM.

In my build:

#!/bin/bash -eo pipefail
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.33.5/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
nvm install $(< .nvmrc)
nvm alias default $(< .nvmrc)
nvm use --delete-prefix v$(< .nvmrc)
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> $BASH_ENV
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12461  100 12461    0     0  84397      0 --:--:-- --:--:-- --:--:-- 84768
=> Downloading nvm from git to '/home/circleci/.nvm'
=> Cloning into '/home/circleci/.nvm'...
remote: Enumerating objects: 261, done.
remote: Counting objects: 100% (261/261), done.
remote: Compressing objects: 100% (228/228), done.
remote: Total 261 (delta 31), reused 98 (delta 24), pack-reused 0
Receiving objects: 100% (261/261), 115.80 KiB | 0 bytes/s, done.
Resolving deltas: 100% (31/31), done.
Note: checking out '6597e11971c5c71da97b67e9e8786dec23d523b1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/circleci/.bashrc
=> Appending bash_completion source string to /home/circleci/.bashrc
N/A: version "10.15 -> N/A" is not yet installed.

You need to run "nvm install 10.15" to install it before using it.
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Exited with code exit status 3
CircleCI received exit code 3

When I SSH to the job:

circleci@4393628a099e:~/project$ set -eo pipefail
circleci@4393628a099e:~/project$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.33.5/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12461  100 12461    0     0   617k      0 --:--:-- --:--:-- --:--:--  640k
=> Downloading nvm from git to '/home/circleci/.nvm'
=> Cloning into '/home/circleci/.nvm'...
Warning: Permanently added the RSA host key for IP address '140.82.112.4' to the list of known hosts.
remote: Enumerating objects: 261, done.
remote: Counting objects: 100% (261/261), done.
remote: Compressing objects: 100% (228/228), done.
remote: Total 261 (delta 31), reused 98 (delta 24), pack-reused 0
Receiving objects: 100% (261/261), 115.80 KiB | 0 bytes/s, done.
Resolving deltas: 100% (31/31), done.
Note: checking out '6597e11971c5c71da97b67e9e8786dec23d523b1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

=> Compressing and cleaning up git repository

=> nvm source string already in /home/circleci/.bashrc
=> bash_completion source string already in /home/circleci/.bashrc
N/A: version "10.15 -> N/A" is not yet installed.

You need to run "nvm install 10.15" to install it before using it.
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
circleci@4393628a099e:~/project$ echo $?
0

So for some reason it works if you put a cd .. at the start. Why would this be the case?

Hello @Pawan.

Exit code 3 is not documented in your link…
I have also this same error without any additional information and no explanation in your docs.

Hey, just found out this convo on nvm github repo https://github.com/nvm-sh/nvm/issues/1985#issuecomment-456022013

It explains why the cd .. actually works.

2 Likes