Skip to content
Latchkey

GitHub Actions Artifact compression-level Invalid or Ineffective

The upload-artifact compression-level must be 0 to 9. An out-of-range value is rejected, and a high level on already-compressed inputs wastes CPU without shrinking the upload.

What this error means

The upload step rejects an invalid compression-level, or artifact uploads are slow with no size benefit because the inputs are already compressed (zips, images, video).

Actions log
Error: Provided compression-level '12' is invalid. Must be between 0 and 9.

Common causes

compression-level out of range

compression-level accepts 0 (store) through 9 (max). Any value outside that range is rejected before the upload.

Compressing already-compressed data

Setting a high level on inputs that are already compressed (zip, png, mp4) spends CPU re-deflating with little or no size reduction.

How to fix it

Use a valid level for the data

Pick 0 for already-compressed inputs to skip pointless work, or a mid/high level for compressible text.

.github/workflows/ci.yml
- uses: actions/upload-artifact@v4
  with:
    name: build
    path: dist/
    compression-level: 6   # 0 = store, 9 = max; 0..9 only

Match the level to the content

  1. Use compression-level: 0 for archives, images, and other pre-compressed files.
  2. Use a higher level for large text, logs, or source trees.
  3. Keep the value within 0 to 9 to avoid the validation error.

How to prevent it

  • Keep compression-level within 0 to 9.
  • Store (level 0) already-compressed artifacts.
  • Reserve higher levels for compressible text-heavy artifacts.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →