hmmm....
If your battery is completely dead, how are you getting it to boot without connecting your power adapter?
You are using an Apple power adapter, and not something like an external battery, correct?
Have you tried an SMC reset, while connected to your power adapter?
Follow these steps -
https://support.apple.com/en-us/HT201295
One change I would make is to NOT press the power button after the reset, just let your MBAir sit attached to the power adapter, and NOT powered on, yet.
Give your MBAir some time, just sitting connected to the power adapter. 30 minutes should be enough.
Boot to the installer, and try the install again.
If the battery is THAT bad (does not charge at all, even after waiting 30 minutes after an SMC reset), and you still get the same message, then - yes - it's time to replace the battery.