I opened up the compressor. It has a mechanical pressure switch, which apparently arcs a bit when it connects or opens. The typical solution to arc noise from mechanical switches is to add an RC snubber.
The RC snubber is a capacitor and resistor in series, connected across the switch:

simulate this circuit – Schematic created using CircuitLab
The capacitor slows down the voltage change over the switch, to avoid arcing when switch opens or the contacts bounce. The resistor limits current spike when the switch closes and dampens oscillators with the motor inductance.
When choosing the parts, a few things must be considered:
- For mains voltage motor, the capacitor must be rated X- or Y-class.
- Larger capacitance will let more current through and heat up. Value of 1 nF to 47 nF is usually suitable.
- Larger resistance will dampen oscillations more and reduce current spike on connection, but increases the maximum peak voltage on disconnection. A value of 5 to 500 ohms is usually suitable.
For me, I happened to have 33 nF X2 capacitor and 10 ohm 1 watt resistor available. Adding them across the switch helped enough that the VFD no longer errors out.