A new sensor has been developed to detect and prevent overheating of lithium-ion batteries.The sensor detects trace amounts of ethylene carbonate (EC), a key component of battery electrolyte.Using covalent organic frameworks (COFs), the sensor is highly sensitive and can detect EC vapour at low concentrations.By detecting potential failures early, the sensor can contribute to safer battery management systems and prevent catastrophic incidents.