Inside all batteries you have an anode, cathode, separator, electrolyte and two current collectors ( + / - ) terminals. All batteries rely upon the chemical reaction of these materials to hold an electrical charge and to delivery that charge. The chemistry of all these things varies in different battery designs. Over time, the electrolyte will eventually cause corrosion on the anode and that corrosion will cause battery cells to stop holding a charge as well. Battery technology is always evolving and the chemistry is altered as well as the design of the cells and different materials last longer before this corrosion occurs but all batteries will encounter corrosion eventually. There are some brand new designs in the early development stages that will offer batteries that last years longer in the future.
Within the 30% of your battery capacity, portions of the cells are shorting out due to anode corrosion and unable to provide a consistent amount of amperage. You can think of amperage like the flow of water through a pipe. Except it's the flow of electrons. Imagine a water wheel being spun by the flow of water. If the flow of the water or the pressure drops then the wheel will stop spinning. The pipe carrying the water is corroded inside and less water can flow. The battery cells that form the first 30% of your battery have corroded anodes. When the charge runs down to those battery cells within the 30% mark, they no longer hold a charge or simply cannot provide enough amperage flow and suddenly your Mac turns off abruptly. If this continues, that 30% will increase till the battery won't hold a charge at all. This happens to all batteries. The batteries in an electric car are no different. The range will be reduced and the ability to quick charge will fail.
Apple has made considerable strides in providing good information to the users of their products about the health of the battery. They are also taking steps to help extend the lifespan of a battery. In iPhones, when you charge them at night, it will charge up to 80% then wait till an hour before you wake to trickle charge the remaining 20% up to 100% charged. They do this because it helps extend the lifespan of the battery. New Apple Silicon M1 Macs work in a similar fashion, pausing the charging at times to extend the battery lifespan. In iPhones and Macs you will be alerted when the health of your battery has degraded. Which explains the message you are seeing.
Unfortunately, your battery is degraded and needs to be replaced. The battery is designed to last under normal average usage patterns between 3-7 years, the typical lifespan of most all laptop computers. Environmental (heat / cold) and usage patterns can age a battery faster than the estimated lifespan. If your Mac is new and your battery fails, Apple will replace it under warranty (AppleCare). If it is out of warranty, $129 for a 13-inch MacBook Air. If it's a very old Mac, Apple or Apple Authorized repair centers may refuse to service it. There are plenty of other repair shops that will service vintage Macs allowing you to use it for a few more years.
As @steve626 mentioned, he was able to have a 3rd party repair center replace his 8 year old 13-inch MacBook Air battery for less than what Apple charges (Apple may have refused to service it) and ended up with a longer lasting charge that exceeds the original battery.
Some links from Apple:
https://support.apple.com/mac/repair/service
https://support.apple.com/en-us/HT204054
https://support.apple.com/en-us/HT212049