theonedev/onedev · error · HttpResponseAwareException
Can not redeploy package: ${pack.getName()}:${pack.getVersio
Error message
Can not redeploy package: ${pack.getName()}:${pack.getVersion()} What it means
uploadBlob enforces Maven's non-snapshot immutability: if the version does not end in '-SNAPSHOT' and a blob with the same name already exists in the pack with a different SHA-256 hash, redeploying is rejected with HTTP 409 CONFLICT. Released artifacts are meant to be immutable; overwriting with different content is blocked.
Source
Thrown at server-plugin/server-plugin-pack-maven/src/main/java/io/onedev/server/plugin/pack/maven/MavenPackHandler.java:408
pack.setName(getName(groupId, artifactId));
pack.setVersion(version != null? version: NONE);
pack.setPrerelease(version != null && version.endsWith(VERSION_SUFFIX_SNAPSHOT));
pack.setData(new MavenData());
}
Build build = null;
if (buildId != null)
build = buildService.load(buildId);
pack.setBuild(build);
pack.setUser(SecurityUtils.getUser());
pack.setPublishDate(new Date());
MavenData data = (MavenData) pack.getData();
var prevSha256BlobHash = data.getSha256BlobHashes().get(blobName);
if (version != null
&& !version.endsWith(VERSION_SUFFIX_SNAPSHOT)
&& prevSha256BlobHash != null
&& !prevSha256BlobHash.equals(sha256BlobHash)) {
throw new HttpResponseAwareException(SC_CONFLICT, "Can not redeploy package: "
+ pack.getName() + ":" + pack.getVersion());
}
data.getSha256BlobHashes().put(blobName, sha256BlobHash);
packService.createOrUpdate(pack, null, false);
if (prevSha256BlobHash != null) {
for (var blobReference: pack.getBlobReferences()) {
if (blobReference.getPackBlob().getSha256Hash().equals(prevSha256BlobHash)) {
packBlobReferenceService.delete(blobReference);
break;
}
}
}
response.setStatus(SC_CREATED);
}));
}
} catch (IOException e) {
throw new RuntimeException(e);
}View on GitHub (pinned to d44925c47c)
Solutions
- Bump the project version (e.g. 1.0.0 → 1.0.1) and redeploy — this is the intended fix.
- If this is genuinely moving-target content, use a -SNAPSHOT version, which is allowed to change.
- Delete the existing pack/version in OneDev (Project > Packages) if it is truly wrong, then redeploy once.
- Fix CI so release jobs only deploy from tagged, reproducible builds.
Example fix
// before (pom.xml) <version>1.0.0</version> <!-- 1.0.0 already deployed with different content --> // after <version>1.0.1</version>
Defensive patterns
Strategy: validation
Validate before calling
# Refuse to deploy a release version that already exists remotely
GROUP_PATH=com/acme/app
VER=1.0.0
ART=app-$VER.jar
STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u "$USER:$TOKEN" "$BASE/~maven/1/$GROUP_PATH/$VER/$ART")
if [ "$VER" != *-SNAPSHOT ] && [ "$STATUS" = "200" ]; then
echo "Version $VER already deployed — bump the version"; exit 1
fi Prevention
- Automate version bumps (mvn release:prepare, versions:set) instead of manual edits.
- Use -SNAPSHOT during development; reserve release versions for tagged builds.
- In CI, deploy only from tag builds with reproducible artifacts.
When it happens
Trigger: Running mvn deploy (or a REST PUT) for a release version like 1.0.0 whose artifact file already exists in the pack but was built with different bytes (new build of the same version).
Common situations: Re-running a release build without bumping the version; CI redeploys of release artifacts from rebuilt binaries; accidentally deploying a release version twice from different commits; Gradle/Maven client configured without proper versioning.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- Branch '${request.getBranchName()}' already exists
- Tag '${request.getTagName()}' already exists
- Can not redeploy package: %s:%s
- Package already exists (name: %s, version: %s)
- Unknown GAV
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/4748b8118b92237c.
Report an issue: GitHub.