GitLab CI "This job depends on other jobs with expired/erased artifacts"
By Daniel Zoghalchali·Latchkey
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.
Diagnose it: which rule matched, and on which runner?
GitLab evaluates rules: top to bottom and the first match wins, including one that sets when: never. A job that does not run, or runs when you did not expect it to, is nearly always matching an earlier rule than the one you are reading.
.gitlab-ci.yml
# validate the definition against the projectcurl -s --header "PRIVATE-TOKEN:$TOKEN" \"https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/ci/lint" \--data-urlencode "content=$(cat .gitlab-ci.yml)"# what the job actually seesscript:- env | grep -E "^CI_(PIPELINE_SOURCE|COMMIT_REF_NAME|RUNNER)" | sort
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.
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 GitLab CI "This job depends on other jobs with expired/erased artifacts"?
There are 3 common causes: artifacts expired, artifacts manually erased, and retrying an old pipeline. The upstream job artifacts:expire_in elapsed before this job retried, so they were cleaned up.
How do I fix GitLab CI "This job depends on other jobs with expired/erased artifacts"?
There are 2 fixes depending on which cause you have: re-run the upstream job to regenerate artifacts and extend artifact expiry for long pipelines. Work through them in order, since the first is the most common.
What does GitLab CI "This job depends on other jobs with expired/erased artifacts" actually mean?
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.
How do I stop GitLab CI "This job depends on other jobs with expired/erased artifacts" happening again?
Set artifacts:expire_in long enough to cover the slowest downstream consumer. The prevention section lists 3 changes that keep it from recurring.