# Artifact Upload Failed

Common Error Patterns

Artifact upload failures typically show:

bash
Failed to upload artifact: Request entity too large
bash
Artifact storage quota exceeded
bash
Error: Artifact upload failed: connection timeout
bash
Permission denied: Cannot write to artifact storage
bash
Failed to create artifact: invalid path format

Root Causes and Solutions

1. Artifact Size Limit Exceeded

Artifact exceeds platform size limits.

Solution:

Check platform limits:

PlatformArtifact LimitTotal Limit
GitHub Actions2GB per artifact10GB per repo
GitLab CI5MB defaultConfigurable
CircleCI5GB per artifact500GB per project
JenkinsConfigurableFile system limit

Reduce artifact size:

```yaml # GitHub Actions - Compress artifacts - name: Create artifact run: | tar -czf build.tar.gz dist/

  • name: Upload artifact
  • uses: actions/upload-artifact@v4
  • with:
  • name: build
  • path: build.tar.gz
  • retention-days: 7
  • `

Split large artifacts:

```yaml - name: Split artifact run: | split -b 500M dist.tar.gz dist-part-

  • name: Upload parts
  • uses: actions/upload-artifact@v4
  • with:
  • name: dist-parts
  • path: dist-part-*
  • `

2. Storage Quota Exceeded

Repository/org storage quota reached.

Solution:

Check storage usage:

```bash # GitHub - via API gh api repos/:owner/:repo/actions/artifacts \ --paginate | jq '[.artifacts[].size_in_bytes] | add'

# Or in UI: Settings > Actions > General > Usage ```

Clean up old artifacts:

bash
# GitHub - Delete old artifacts
gh api repos/:owner/:repo/actions/artifacts \
  --paginate | jq '.artifacts[] | select(.expired == false) | .id' | \
  while read id; do
    gh api repos/:owner/:repo/actions/artifacts/$id -X DELETE
  done

Set retention policies:

yaml
# GitHub Actions - Set retention
- name: Upload artifact
  uses: actions/upload-artifact@v4
  with:
    name: build
    path: dist/
    retention-days: 5  # Delete after 5 days

Global retention policy:

yaml
# .github/workflows/settings.yml - Not supported directly
# Set in repository settings:
# Settings > Actions > General > Artifact and log retention

3. Network/Timeout Issues

Upload fails due to network problems.

Solution:

Increase timeout:

yaml
# GitHub Actions
- name: Upload with retry
  uses: nick-fields/retry@v2
  with:
    timeout_minutes: 30
    max_attempts: 3
    command: |
      # Manual upload
      gh api repos/:owner/:repo/actions/artifacts \
        -X POST -H "Content-Type: application/octet-stream" \
        --input build.tar.gz

For CircleCI:

yaml
- store_artifacts:
    path: dist/
    destination: build
    # CircleCI handles retries automatically

4. Permission Denied

Cannot write to artifact storage.

Solution:

Check workflow permissions:

```yaml # GitHub Actions - Add permissions permissions: contents: read actions: write # Required for artifacts

jobs: build: runs-on: ubuntu-latest steps: - name: Upload artifact uses: actions/upload-artifact@v4 with: name: build path: dist/ ```

For GitLab:

yaml
# Check job token permissions
job:
  artifacts:
    paths:
      - dist/
    expire_in: 1 week
  script: ./build.sh

5. Invalid Artifact Path

Artifact path doesn't exist or is invalid.

Solution:

Verify path exists:

```yaml - name: Check artifact path run: | ls -la dist/ if [ ! -d "dist/" ]; then echo "Artifact path does not exist" exit 1 fi

  • name: Upload artifact
  • uses: actions/upload-artifact@v4
  • with:
  • name: build
  • path: dist/
  • if-no-files-found: error # Fail if no files
  • `

Handle missing files:

yaml
- name: Upload artifact
  uses: actions/upload-artifact@v4
  with:
    name: build
    path: |
      dist/
      reports/
    if-no-files-found: warn  # Warn but continue

6. Artifact Upload Action Version

Using deprecated action version.

Solution:

Update to latest version:

yaml
# Use latest v4
- name: Upload artifact
  uses: actions/upload-artifact@v4
  with:
    name: build
    path: dist/

v4 changes: - Improved upload speed - Better compression - Changed behavior for multiple artifacts

For compatibility:

yaml
# v3 - deprecated but still works
- uses: actions/upload-artifact@v3

7. Concurrent Upload Conflicts

Multiple jobs uploading to same artifact name.

Solution:

Use unique artifact names:

yaml
- name: Upload artifact
  uses: actions/upload-artifact@v4
  with:
    name: build-${{ github.run_id }}-${{ github.job }}
    path: dist/

Or merge artifacts:

```yaml # Upload from multiple jobs jobs: build: outputs: artifact-id: ${{ steps.upload.outputs.artifact-id }} steps: - name: Upload id: upload uses: actions/upload-artifact@v4 with: name: build-${{ github.run_attempt }} path: dist/

merge: needs: [build] steps: - name: Download all uses: actions/download-artifact@v4 with: pattern: build-* merge-multiple: true path: merged/

  • name: Upload merged
  • uses: actions/upload-artifact@v4
  • with:
  • name: final-build
  • path: merged/
  • `

8. GitLab Artifact Limits

GitLab has strict artifact limits.

Solution:

Configure GitLab artifacts:

yaml
# .gitlab-ci.yml
job:
  artifacts:
    name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
    paths:
      - dist/
      - reports/
    exclude:
      - dist/**/*.log
      - dist/**/*.tmp
    expire_in: 1 week
    when: always  # Upload even on failure

Increase limits in GitLab settings:

bash
# Admin Area > Settings > CI/CD > Artifacts
# Increase maximum artifacts size

Platform-Specific Solutions

GitHub Actions

```yaml # Full artifact workflow jobs: build: runs-on: ubuntu-latest permissions: actions: write steps: - uses: actions/checkout@v4

  • name: Build
  • run: npm run build
  • name: Compress
  • run: tar -czf artifact.tar.gz dist/
  • name: Upload
  • uses: actions/upload-artifact@v4
  • with:
  • name: build-output
  • path: artifact.tar.gz
  • retention-days: 7
  • compression-level: 6 # 0-9, default 6
  • `

GitLab CI

yaml
build:
  stage: build
  script:
    - npm run build
  artifacts:
    paths:
      - dist/
    exclude:
      - "**/*.log"
    expire_in: 1 week
    when: always

CircleCI

yaml
jobs:
  build:
    docker:
      - image: node:18
    steps:
      - checkout
      - run: npm run build
      - store_artifacts:
          path: dist/
          destination: build-output

Jenkins

groovy
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        sh 'npm run build'
      }
      post {
        success {
          archiveArtifacts artifacts: 'dist/**/*', fingerprint: true
        }
      }
    }
  }
}

Debugging Commands

```bash # Check artifact existence ls -la dist/

# Test compression tar -czf test.tar.gz dist/ && ls -lh test.tar.gz

# GitHub - List artifacts gh api repos/:owner/:repo/actions/artifacts | jq '.artifacts[]'

# Download artifact gh run download $RUN_ID --repo :owner/:repo

# Check artifact size du -sh dist/ ```

Quick Reference

PlatformLimitConfig Location
GitHub2GB/artifact, 10GB/repoSettings > Actions
GitLab5MB-5GBAdmin settings
CircleCI5GB/artifactProject settings
JenkinsFile systemJob config

Prevention Tips

  1. 1.Compress artifacts before upload
  2. 2.Set appropriate retention policies
  3. 3.Exclude unnecessary files
  4. 4.Monitor storage usage regularly
  5. 5.Use unique artifact names for parallel jobs
  6. 6.Add error handling for upload failures
  • [GitHub Actions Workflow Failed](#)
  • [Jenkins Build Failed](#)
  • [Test Coverage Threshold Not Met](#)