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.
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.
web-ext build --source-dir dist --overwrite-destClean the artifacts directory first
Remove old zips before building so each run starts from an empty output directory.
- run: rm -rf web-ext-artifacts
- run: npx web-ext build --source-dir distHow to prevent it
- Clean
web-ext-artifacts/at the start of the build step. - Exclude artifact directories from caches.
- Use
--overwrite-destwhen builds may repeat in one job.