# GitLab CI: This job could not start because it could not retrieve the needed artifacts (dependencies: build).

**Code:** `Job depends on artifacts that have expired` · **Category:** CI/CD · **Seen on:** GitLab CI

A job needs artifacts from an earlier job, but that job failed, was skipped or its artifacts have expired or been deleted.

## Meaning

With `dependencies:` or `needs: [artifacts: true]`, the earlier job must have succeeded and still hold its artifacts. If `expire_in` has passed, or you retried a later job in an old pipeline, they are gone. Re-run the producing job, extend `expire_in`, or keep the artifacts of the latest successful pipeline.

## Common causes

- Artifacts expired (`expire_in` passed)
- Producing job failed or was skipped by rules
- Retrying a late stage of an old pipeline
- Job names in `dependencies` do not match
- Artifacts deleted manually or by cleanup

## Quick fix

1. Re-run the producing job to regenerate artifacts
2. Increase `artifacts:expire_in` or use `keep latest artifacts`
3. Fix `dependencies`/`needs` job names

## Detailed fix by platform

### GitLab CI

1. Settings → CI/CD → Artifacts → Keep artifacts from most recent successful jobs

## Code examples

### Explicit dependency

```yaml
test:
  stage: test
  needs:
    - job: build
      artifacts: true
  script: ./run-tests.sh dist/
```

## How to diagnose

1. **Producer** — Did the build job succeed?
2. **Age** — Past expire_in?
3. **Names** — Matching job names?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/gitlab-dependency-expired-artifacts)
