Lesstep
Bitbucket Cloud · Pipelines · Checked October 29, 2026

Bitbucket Pipelines: "command not found"

The step's log shows a line like aws: command not found, and the step fails at that command. The shell looked for a program called aws in each directory of $PATH and found none. Atlassian's article (Pipelines build failed with "Command not found") gives two causes; two more follow from how steps run. In images whose shell is sh rather than bash, such as Alpine, the line says not found instead.

1. A variable named PATH

A workspace, repository or deployment variable called PATH replaces the build's own $PATH, so the shell stops finding commands, often all of them. Rename the variable to say what it is for, such as REMOTE_PATH or DEPLOY_PATH, and use the new name in your script. Atlassian's article points to BCLOUD-20162, a request for a warning about this name on the variables page.

2. The tool is not in the image

On Bitbucket's own machines and on Linux Docker runners, a step runs in a Docker container, and only the programs in its image are there. With no image in bitbucket-pipelines.yml, Bitbucket uses atlassian/default-image:latest. Atlassian lists five versions of it (Use Docker images as build environments); atlassian/default-image:5 is Ubuntu 24.04 with Git, Node.js 22, Python 3.12 and the Docker CLI. Slim and Alpine images leave out much more. Either pick an image that has the tool, or install it in the script:

pipelines:
  default:
    - step:
        image: ubuntu:24.04
        script:
          - apt-get update
          - apt-get install -y jq
          - jq --version

On Alpine the line is apk add --no-cache jq. On a Linux shell, macOS or Windows runner there is no container: the step runs on the runner's machine, so install the tool there.

3. It was installed in another step

From Atlassian's Step options: each step starts a separate Docker container. A tool installed in the first step is gone in the second. Install it in the step that uses it, or use an image that already has it in every step that needs it.

4. It was installed where PATH does not look

Check before you change anything

Put these lines just before the command that fails, then run the pipeline again:

script:
  - echo "$PATH"
  - command -v aws || echo "no aws"
  - aws --version

A short or odd $PATH points to cause 1. A normal one, and no aws, points to 2, 3 or 4.

See the failed command from IntelliJ IDEA

Pipeline Inbox for Bitbucket Pipelines, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the pipelines of all your Bitbucket Cloud repositories in an IDE tool window. For a failed pipeline it shows the command the step failed at and that command's last lines, so "command not found" is on screen without opening the log, and it opens bitbucket-pipelines.yml in the editor when the project has it. After renaming a PATH variable there is no new commit to push: with Pro, Run again builds the same commit once more from the IDE. The list, steps and logs are free; running, re-running and stopping pipelines are Pro (US$1.50 a month, with a 30-day trial).

Get it on JetBrains Marketplace

Atlassian, Bitbucket and Bitbucket Pipelines are trademarks of Atlassian; Docker is a trademark of Docker, Inc.; Ubuntu is a registered trademark of Canonical Ltd.; Node.js is a trademark of the OpenJS Foundation; Python is a registered trademark of the Python Software Foundation; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by any of them.

More: "unexpected system error" · The cache is not used · Pipelines did not run after a push · "Exceeded build time limit of 120 minutes" · "Container 'Build' exceeded memory limit." · "Container 'docker' exceeded memory limit." · Submodules not cloned · "We couldn't clone the repository" · "No online runner available" · "No space left on device" · "Step exceeded processing limits" · The artifact is missing in the next step · The build passed before and fails now · Build setup takes too long · "You've run out of build minutes" · "Permission denied to update branch" · "You have reached your pull rate limit" (Docker Hub) · "There is an error in your bitbucket-pipelines.yml" · "This pipeline was paused" (deployments) · Bitbucket Pipelines plugins for IntelliJ IDEA, compared · 日本語