Skip to content
Latchkey

GitLab CI "This job depends on other jobs with expired/erased artifacts"

When a job uses needs (or dependencies) to pull artifacts from an earlier job, those artifacts must still exist. If their expiry passed or they were manually erased, the download fails.

What this error means

The job shows a message that it depends on other jobs with expired or erased artifacts, and refuses to start or fails immediately when retried much later.

gitlab-ci
This job depends on other jobs with expired/erased artifacts:
build. Please refer to the documentation on artifact expiry.

Common causes

Artifacts expired

The upstream job artifacts:expire_in elapsed before this job retried, so they were cleaned up.

Artifacts manually erased

A maintainer erased the upstream job, deleting its artifacts.

Retrying an old pipeline

Re-running a downstream job long after the pipeline finished finds the inputs already gone.

How to fix it

Re-run the upstream job to regenerate artifacts

Retry from the producing job (or the whole pipeline) so artifacts are recreated before the consumer runs.

  1. Open the pipeline and retry the upstream job that produces the artifacts.
  2. Wait for it to upload artifacts, then retry the dependent job.
  3. If the pipeline is old, run a fresh pipeline instead.

Extend artifact expiry for long pipelines

Increase expire_in on producers whose outputs feed late-running consumers.

.gitlab-ci.yml
build:
  script: make build
  artifacts:
    paths: [dist/]
    expire_in: 1 week

How to prevent it

  • Set artifacts:expire_in long enough to cover the slowest downstream consumer.
  • Avoid retrying single downstream jobs in very old pipelines.
  • Use keep:latest on critical artifacts where supported.

Frequently asked questions

What causes ""needs" artifacts gone"?
The upstream job artifacts:expire_in elapsed before this job retried, so they were cleaned up.
How do I fix "needs" artifacts gone?
Retry from the producing job (or the whole pipeline) so artifacts are recreated before the consumer runs.

Related guides

References

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