GoReleaser "dist is not empty, use --clean" in CI
GoReleaser writes artifacts to dist/ and refuses to run if that folder already has content, to avoid mixing old and new builds. The --clean flag removes it first; the old --rm-dist flag was removed.
What this error means
GoReleaser fails with "dist is not empty, use the --clean flag to remove it" or, on newer versions, "unknown flag: --rm-dist".
Terminal
⨯ release failed after 0s
error=dist is not empty, please remove before running or use the --clean flagCommon causes
A leftover dist directory
A cached workspace or a previous step left dist/ populated, and GoReleaser will not overwrite it silently.
The removed --rm-dist flag
Older workflows call --rm-dist, which no longer exists; the current flag is --clean.
How to fix it
Use --clean
Pass --clean so GoReleaser removes dist/ before building.
.github/workflows/release.yml
- uses: goreleaser/goreleaser-action@v6
with:
args: release --cleanReplace --rm-dist with --clean
Update any old invocation; --rm-dist was renamed to --clean.
Terminal
goreleaser release --cleanHow to prevent it
- Always pass
--cleanin CI sodist/starts fresh. - Gitignore
dist/so it never gets committed or cached dirty. - Search workflows for the removed
--rm-distflag and update them.
Related guides
GoReleaser "git is currently in a dirty state" in CIFix GoReleaser "git is currently in a dirty state" in CI - uncommitted or generated files make the working tr…
GoReleaser "only configurations files on version: 2 are supported" in CIFix GoReleaser "only configurations files on version: 2 are supported" in CI - GoReleaser v2 requires a top-l…
GoReleaser "build failed: exit status 1" in CIFix GoReleaser "build failed: exit status 1" in CI - the underlying go build for one target failed, so GoRele…