Skip to content

GitLab CI Artifact Upload Error Fix

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about GitLab CI Artifact Upload Error Fix. We cover key concepts, practical examples, and best practices.

Your GitLab CI job fails with Uploading artifacts to coordinator... error — the artifact file path is wrong, the file is too large, or the runner has no storage configured.

The Problem

# WRONG — artifact path that doesn't exist
build:
  script:
    - mkdir -p dist
    - echo "built" > dist/app.js
  artifacts:
    paths:
      - dist/app.min.js
Uploading artifacts to coordinator... error
FATAL: invalid argument

The pipeline creates dist/app.js but the artifact path specifies dist/app.min.js. GitLab CI checks if the path exists before uploading — if it doesn't, the job fails with an upload error.

Step-by-Step Fix

1. Match artifact paths to actual files

build:
  script:
    - npm run build
  artifacts:
    paths:
      - dist/
    expire_in: 1 week

2. Set artifact size limits

build:
  artifacts:
    paths:
      - dist/
    reports:
      junit: test-results/**/junit.xml
    expire_in: 30 days

pages:
  script:
    - mv public/ public_html/
  artifacts:
    paths:
      - public_html

GitLab has a default artifact size limit (varies by plan — typically 100MB-1GB). Set expire_in to auto-delete artifacts after a period.

3. Pass artifacts between jobs

build:
  stage: build
  artifacts:
    paths:
      - dist/
    expire_in: 1 hour

test:
  stage: test
  needs: [build]
  script:
    - ls dist/
    - npm run test

4. Use reports for test results

test:
  artifacts:
    reports:
      junit: test-results/junit.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml

Expected output:

Uploading artifacts...
dist/: found 15 files
Uploading artifacts to coordinator... ok
Job succeeded

Prevention Tips

  • Verify artifact paths exist in the build directory
  • Use directories (dist/) instead of individual files
  • Set expire_in to manage storage costs
  • Use needs: for explicit job dependencies
  • Check the project's artifact size limit in Settings > CI/CD

Common Mistakes with ci artifact

  1. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  2. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  3. Using head and tail instead of pattern matching, causing runtime errors on empty lists

These mistakes appear frequently in real-world GITLAB code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why do my artifacts upload but I can't download them?

Either the expire_in time has passed, the artifacts were manually deleted, or the job was retried. Check the job's artifacts section in the UI. Also ensure the artifact is from the latest successful pipeline, not a failed one.

What's the maximum artifact size in GitLab?

For GitLab.com SaaS: 100MB on Free, 1GB on Premium, 2GB on Ultimate. Self-managed instances have configurable limits. Exceeding the limit causes the upload to fail. Split large artifact sets across multiple jobs or use a cloud storage integration.

How do I prevent artifacts from filling up runner disk space?

Set expire_in on every artifact (e.g., 1 week for temporary build artifacts). Use dependencies: to control which artifacts each job downloads. Run periodic cleanup with gitlab-rake gitlab:cleanup:orphan_artifact_files. Use object storage (S3, GCS) for artifact storage.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro