# GitLab "job succeeded but artifacts missing": artifact debugging

TL;DR: Open the producing job's log and look at the `Uploading artifacts` lines at the end. Almost always the path glob matched nothing, so nothing was uploaded, and the downstream job correctly found nothing. Fix the path relative to the project root and confirm the log lists uploaded files.

```text
WARNING: artifacts: no matching files
```

## Steps

1. Scroll to the end of the producing job's log and find the `Uploading artifacts...` section. If it warns about no matching files, the `paths` glob did not match anything.
**Expected:** You see exactly which paths were tried.

2. Fix the paths to be relative to the project directory, not to wherever the script's working directory happened to be. Remember the job may have `cd`'d into a subdirectory.
**Expected:** The next run's log lists the files being uploaded.

3. Confirm the upload actually succeeded. Look for the `ok` after the upload-to-coordinator line. A failed upload from a network blip or a full runner disk leaves the job green with nothing stored.
**Expected:** The log shows a successful upload with a file count.

4. In the consuming job, check `needs:` (or `dependencies:`) names the producing job. Without that link the job downloads nothing from it.
**Expected:** The downstream log shows `Downloading artifacts` for the right job.

5. Check size and expiry. An artifact bigger than the project or instance limit fails the upload with a clear error, and `expire_in` deletes artifacts before a later manual download.
**Expected:** Artifact size is under the limit and expiry covers your download window.

6. Check `artifacts:when:`. If it is set to `on_failure` the job only uploads when it fails; a green job then legitimately produces nothing.
**Expected:** `when` matches the outcome you expect artifacts from.

## Use this when
- A pipeline job is green but its artifacts tab is empty or says missing
- A downstream job fails because files an earlier job should have produced are not there

## Not for this skill when
- The producing job itself failed. Fix the job first
- Artifacts exist but are corrupt. Different problem
- GitLab Pages did not deploy. That is a pages job issue, not artifacts

## Variant phrasings
### Job log shows "no matching files" for artifacts
The glob is wrong; steps 1 and 2 above.

### Downstream job errors with "file not found" for a build output
The producer never uploaded it; work backward through the steps above.

## Why it happens
The runner uploads artifacts to the coordinator when the job ends, resolving `paths` against the project directory. A glob that matches nothing is only a warning, not a failure, so the job stays green while storing nothing. Downstream jobs then download an empty set and fail later, far from the real cause.

## Edge cases
- Untracked files need `artifacts:untracked: true`; tracked-file globs ignore them silently
- Dotenv reports need `artifacts:reports:dotenv`, and they never appear as downloadable files
- Cache is not artifacts: a cache miss never fails a job and cached files are not downloadable from the UI
- `needs:` with `optional: true` silently skips a job that did not run

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_oUE8XwxXqs1rdevaswsHKQ
