I reported this issue upstream to https://github.com/OpenPrinting/cups/issues/1078 and it turned out that the root cause was some invalid names in the ppd file. It had an invalid character in some of the size names - the '#' in "Envelope#10", "JapaneseEnvelope#3.FB" and "JapaneseEnvelope#4.FB".
I think it's still wrong for cups to respond with a syntactically invalid response to get-printer-attributes in this case, so I'm keeping this bug open for now. I'll clone it into another bug against hpcups which I think is responsible for the PPD file.