Skip to content
Latchkey

Bitbucket Artifact Not Found Between Steps

A later step expected files from an earlier step, but the artifact was never produced under a matching glob - so the files are not present when the downstream step runs.

What this error means

A build step succeeds, but a later deploy/test step fails because expected files (e.g. dist/) are missing. Each step starts from a clean checkout; only declared artifacts carry forward.

Bitbucket log
cp: cannot stat 'dist/app.js': No such file or directory
# the build step never declared dist/** as an artifact

Common causes

Producer step did not declare the artifact

Steps do not share a filesystem. Unless the producing step lists the output under artifacts:, the files are discarded when that step ends.

Artifact glob does not match the output path

A glob like build/** will not capture files written to dist/. A mismatch between where files are written and the declared paths yields an empty artifact.

How to fix it

Declare artifacts on the producing step

List the output paths so they are saved and restored into later steps.

bitbucket-pipelines.yml
- step:
    name: Build
    script: [ npm run build ]
    artifacts:
      - dist/**
- step:
    name: Deploy
    script: [ ./deploy.sh dist ]

Match globs to the real output location

  1. Confirm where the build actually writes files (ls -R after build).
  2. Set the artifact glob to that exact path.
  3. Remember artifacts only carry to later steps in the same pipeline run.

How to prevent it

  • Declare artifacts: on every step whose output a later step consumes.
  • Keep artifact globs in sync with build output paths.
  • Verify artifact contents with a quick ls in the consuming step while debugging.

Frequently asked questions

What causes ""Artifact ... not found""?
Steps do not share a filesystem. Unless the producing step lists the output under artifacts:, the files are discarded when that step ends.
How do I fix "Artifact ... not found"?
List the output paths so they are saved and restored into later steps.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card