# Builds started failing around PATH/BASH\_ENV usage

**URL:** <https://discuss.circleci.com/t/builds-started-failing-around-path-bash-env-usage/37255>\
**Category:** Bug Reports\
**Created:** [August 31, 2020, 9:26am UTC](https://discuss.circleci.com/t/builds-started-failing-around-path-bash-env-usage/37255 "2020-08-31T09:26:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lightpriest](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/lightpriest/32/25562_2.png) [@lightpriest](https://discuss.circleci.com/u/lightpriest)\
**Post date:** [August 31, 2020, 9:26am UTC](https://discuss.circleci.com/t/builds-started-failing-around-path-bash-env-usage/37255/1 "2020-08-31T09:26:06Z")

</div>

Our builds have started to fail, specifically those the depends on populating and re-using `$PATH`.  
Was there any change done recently that prevents this usage or something?

The agent version that runs for us is: `Build-agent version 1.0.38841-5271c1f7 (2020-08-28T15:52:24+0000)`.  
The failure is in one of the commands of the `https://circleci.com/orbs/registry/orb/circleci/aws-sam-serverless` orb, though we didn’t change a version or configuration that might trigger this.

Eventually the error that we see is:

```auto
/bin/bash: line 2: sam: command not found

```

Although this command worked as expected in previous commits (older agent versions).

When running with SSH, we needed to manually source $BASH\_ENV for it to work. Was that always the case? Or was $BASH\_ENV supposed to be sourced automatically in a bash session?

---

<div class="post-metadata">

**Author:** ![annapamela](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@annapamela](https://discuss.circleci.com/u/annapamela)\
**Post date:** [August 31, 2020, 2:32pm UTC](https://discuss.circleci.com/t/builds-started-failing-around-path-bash-env-usage/37255/2 "2020-08-31T14:32:54Z")

</div>

Hi @lightpriest and welcome to the forum!

> When running with SSH, we needed to manually source $BASH\_ENV for it to work. Was that always the case? Or was $BASH\_ENV supposed to be sourced automatically in a bash session?

Yes, you do usually need to manually source $BASH\_ENV in the SSH container. The shells in your SSH container and your job container are slightly different.

The default shell is a non-login shell, while in SSH, we prepend `-` to the shell when not specified to force it to run a login shell. This article walks through which files the shell sources: [Zsh/Bash startup files loading order (.bashrc, .zshrc etc.) | by Raja Sekar Durairaj | Medium](https://medium.com/@rajsek/zsh-bash-startup-files-loading-order-bashrc-zshrc-etc-e30045652f2e).

Since the job is non-interactive, it follows the “Interactive? → No. → --login? → No. → $BASH\_ENV” path. The SSH job is interactive and therefore follows a different path.

So for example, in a config like this:

```auto
version: 2.1

jobs:
  my-test-job:
    docker:
      - image: circleci/ruby:2.6.0-stretch
    steps:
      - checkout
      - run: |
          echo "export FOO='BAR'" >> $BASH_ENV
          cat $BASH_ENV
      - run: echo $FOO

workflows:
  tests:
    jobs:
      - my-test-job

```

`BAR` will print in downstream steps as expected. However, if you SSH into the job, you will have to source $BASH\_ENV to have access to $FOO:

```auto
circleci@3be2ac6111ff:~$ echo $FOO

circleci@3be2ac6111ff:~$ source $BASH_ENV
circleci@3be2ac6111ff:~$ echo $FOO
BAR

```

Finally, if you are continuing to encounter issues with the orb, please don’t hesitate to submit an issue on the orb source Github page: [Issues · CircleCI-Public/aws-sam-serverless-orb · GitHub](https://github.com/CircleCI-Public/aws-sam-serverless-orb/issues). Our Community & Partner Engineering team reviews these issues regularly!

I hope that clarifies things! Please do let me know if you have additional questions!

---

<div class="post-metadata">

**Author:** ![lightpriest](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/lightpriest/32/25562_2.png) [@lightpriest](https://discuss.circleci.com/u/lightpriest)\
**Post date:** [September 3, 2020, 8:56am UTC](https://discuss.circleci.com/t/builds-started-failing-around-path-bash-env-usage/37255/3 "2020-09-03T08:56:44Z")

</div>

Thanks a lot for the response. Eventually, yeah, we figured it was an issue with sam’s brew tap, and that simply calling `brew install ..` twice works around it, for the time being.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [September 13, 2020, 8:56am UTC](https://discuss.circleci.com/t/builds-started-failing-around-path-bash-env-usage/37255/4 "2020-09-13T08:56:49Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
