I solved it. The problem was in table “llx_payment_various”, field “ref”: It needs to allow nulls, but in my installation it was set to not nullable.
I wouldn’t make such change easily, but I compared the field settings to a default installation, and there it was set to nullable. I’m not sure why this happened, my hunch is that in an earlier version, it might have been not nullable, and when I upgraded, at some point in my db it wasn’t changed.