# Artifact Upload Failed
Common Error Patterns
Artifact upload failures typically show:
Failed to upload artifact: Request entity too largeArtifact storage quota exceededError: Artifact upload failed: connection timeoutPermission denied: Cannot write to artifact storageFailed to create artifact: invalid path formatRoot Causes and Solutions
1. Artifact Size Limit Exceeded
Artifact exceeds platform size limits.
Solution:
Check platform limits:
| Platform | Artifact Limit | Total Limit |
|---|---|---|
| GitHub Actions | 2GB per artifact | 10GB per repo |
| GitLab CI | 5MB default | Configurable |
| CircleCI | 5GB per artifact | 500GB per project |
| Jenkins | Configurable | File 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:
# 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
doneSet retention policies:
# GitHub Actions - Set retention
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build
path: dist/
retention-days: 5 # Delete after 5 daysGlobal retention policy:
# .github/workflows/settings.yml - Not supported directly
# Set in repository settings:
# Settings > Actions > General > Artifact and log retention3. Network/Timeout Issues
Upload fails due to network problems.
Solution:
Increase timeout:
# 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.gzFor CircleCI:
- store_artifacts:
path: dist/
destination: build
# CircleCI handles retries automatically4. 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:
# Check job token permissions
job:
artifacts:
paths:
- dist/
expire_in: 1 week
script: ./build.sh5. 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:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build
path: |
dist/
reports/
if-no-files-found: warn # Warn but continue6. Artifact Upload Action Version
Using deprecated action version.
Solution:
Update to latest version:
# 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:
# v3 - deprecated but still works
- uses: actions/upload-artifact@v37. Concurrent Upload Conflicts
Multiple jobs uploading to same artifact name.
Solution:
Use unique artifact names:
- 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:
# .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 failureIncrease limits in GitLab settings:
# Admin Area > Settings > CI/CD > Artifacts
# Increase maximum artifacts sizePlatform-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
build:
stage: build
script:
- npm run build
artifacts:
paths:
- dist/
exclude:
- "**/*.log"
expire_in: 1 week
when: alwaysCircleCI
jobs:
build:
docker:
- image: node:18
steps:
- checkout
- run: npm run build
- store_artifacts:
path: dist/
destination: build-outputJenkins
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
| Platform | Limit | Config Location |
|---|---|---|
| GitHub | 2GB/artifact, 10GB/repo | Settings > Actions |
| GitLab | 5MB-5GB | Admin settings |
| CircleCI | 5GB/artifact | Project settings |
| Jenkins | File system | Job config |
Prevention Tips
- 1.Compress artifacts before upload
- 2.Set appropriate retention policies
- 3.Exclude unnecessary files
- 4.Monitor storage usage regularly
- 5.Use unique artifact names for parallel jobs
- 6.Add error handling for upload failures
Related Articles
- [GitHub Actions Workflow Failed](#)
- [Jenkins Build Failed](#)
- [Test Coverage Threshold Not Met](#)