Skip to content
Latchkey

web-ext build "Artifact already exists" / overwrite in CI

web-ext build will not silently overwrite an existing zip in the artifacts directory. On a re-run or a cached workspace the file is already there, so the build aborts unless you allow overwriting.

What this error means

web-ext build fails with "Artifact <name>.zip already exists. Use --overwrite-dest to enable overwriting." and exits non-zero.

web-ext
UsageError: Artifact web-ext-artifacts/my_addon-1.0.0.zip already exists.
Use --overwrite-dest to enable overwriting.

Common causes

A stale artifact from a cached or restored workspace

A previous build left the zip in web-ext-artifacts/, and the cache or checkout restored it, so the name collides.

The same version built twice in one job

Re-running the build step without bumping the version produces the same filename.

How to fix it

Allow overwriting the destination

Pass --overwrite-dest so a repeat build replaces the previous artifact.

Terminal
web-ext build --source-dir dist --overwrite-dest

Clean the artifacts directory first

Remove old zips before building so each run starts from an empty output directory.

.github/workflows/ci.yml
- run: rm -rf web-ext-artifacts
- run: npx web-ext build --source-dir dist

How to prevent it

  • Clean web-ext-artifacts/ at the start of the build step.
  • Exclude artifact directories from caches.
  • Use --overwrite-dest when builds may repeat in one job.

Related guides

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