To not bury the lede: my name (David Matz) is in the Gleam 1.16.0 release notes! Very excited.
I was trying to publish a package to hex.pm and getting an error Can only modify a release up to one hour after publication which was very confusing ("this is a new release? should I bump the version one more? but it is a new version? what..."). Of course with hindsight you know to check the build tool itself, but at the time I got stuck for a few hours looking on google, elixirforum, claude, etc. I finally cloned gleam-lang/gleam and pointed claude at it which found the problem. Again in hindsight maybe you don't need AI, could just grep the error message, but things are harder to figure out in the moment, especially when you assume the error message is correct about what you're publishing wrong, which is usually true.
The problem was on gleam publish, hex.pm returns a potential error, and gleam pattern matches on the status code, but then if it's an error 422 gleam further pattern matches on the message body, and if nothing matches it falls through to ApiError::LateModification. In general pattern matching on status codes is great, pattern matching on a string is sketchier, as there's more of a danger of error message strings changing, but people rely on them anyways. So maybe the cleanest/most complete fix would be to make 422 case stop pattern matching on message body entirely, but I wasn't sure what else gleam is doing and didn't want to change anything not obviously wrong. So I just changed it to fall through to printing the whole message body string if it no pattern matches. I think this is good because if you are getting some obscure hex error 1) you're probably in some weird uncommon path 2) you probably want the full verbatim error to google.
I wrote this up in an issue which was quickly approved. I struggled a bit making the actual code change, not being familiar with Rust, hex.pm, or gleam project standards. Fortunately the maintainer was nice and helpful, and eventually merged the pull request. Discovering the error, testing cases, and writing up the issue are helpful for the gleam project, whereas the code change would probably be easier for a gleam core team member to do on their own, rather than shepherd me through, so hopefully it adds up to a positive contribution overall.
If you get some weird 422 error on gleam publish such as
An unexpected response was sent by Hex: 422 Unprocessable Entity: {"message":"Validation error(s)", "status":422,"errors":{"tar":"file too big: metadata.config"}} you're welcome! Although you're probably not totally happy as you have some problem to work out, but at least you don't have 2 problems (problem + wrong error), it could be worse.