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.
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.
- Open the pipeline and retry the upstream job that produces the artifacts.
- Wait for it to upload artifacts, then retry the dependent job.
- 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.
build:
script: make build
artifacts:
paths: [dist/]
expire_in: 1 weekHow 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.