I'm probably like most partners and I find myself lurking around these forums more than posting in them. I thought I'd share a minor fix that might help others.
When performing an ajax post to /cart/add.js, I was getting a 422 error. This seems easy now, but it still took time to identify.
The issue is, when creating variants on-the-fly, I wasn't setting the inventory_policy value. The default for this value is 'deny'. This means that I would create a variant, the initial inventory would be zero, then the add to cart would fail because it's not allowed to be sold when there isn't inventory. In my case, I wanted to create the variant with an inventory_policy of 'continue' so that the variant could be added to the cart.
Like I said, seems easy now.