It’s been a long while since I wrote something, and now I’m writing a post which is somewhat ranty about one of my favourite things: GitHub Packages. I love GitHub packages, it’s one of the most useful features of GitHub. Even, I daresay, more important to me than GitHub Actions. However, nothing comes without problems, and for Packages, it was the “422 Unprocessable Entity” response when I tried to publish a certain Maven POM.
The Problem
I have a Maven project with a lot of modules, and all are deployed to
GitHub Packages. I recently added a new module, a Bill of Material (BOM)
to be specific, and that one just couldn’t get deployed. Whenever mvn deploy
is executed, that modeul fails with 422 Unprocessable Entity
.
Of course I looked it up, and I found few other people who had a similar issue but the cause either didn’t apply to my case or the fix did nothing. Nothing I found was of any help. That BOM is more of a convenience thing so it’s not really an important module, and I could just skip it, but why get rid of something that’ll make people’s lives easier? Besides, I was now very curious to know why that happened.
The Path
The error was somewhat clear, it’s an unprocessable entity; I might, somehow, be submitting an invalid POM, even though it works locally. Therefore, on I went examining the POM file, checking the parent that is referenced, reviewing the dependency section. Nothing. Generated the effective POM and reviewed it but to no avail. Everything led to nowhere.
The Cause
When you publish a duplicate artifact, you get 409 Conflict
, but only
if the package is in the same repository. That particular module was part
of another project, and was then moved to the new one. As it turned out,
GitHub didn’t like that the same artifact was available on two repositories
under the same organization. However, it didn’t return a status code of 409,
it returned 422 instead. Removing the previous entries, which were no longer
needed anyway, fixed the problem.
Conclusion
I seriously need to start writing more…