To build a universal quantum computer from fragile physical qubits, effective implementation of quantum error correction (QEC)1 is an essential requirement and a central challenge. Existing demonstrations of QEC are based on an active schedule of error-syndrome measurements and adaptive recovery operations2,3,4,5,6,7 that are hardware intensive and prone to introducing and propagating errors. In principle, QEC can be realized autonomously and continuously by tailoring dissipation within the quantum system1,8,9,10,11,12,13,14, but so far it has remained challenging to achieve the specific form of dissipation required to counter the most prominent errors in a physical platform. Here we encode a logical qubit in Schrödinger cat-like multiphoton states15 of a superconducting cavity, and demonstrate a corrective dissipation process that stabilizes an error-syndrome operator: the photon number parity. Implemented with continuous-wave control fields only, this passive protocol protects the quantum informationby autonomously correcting single-photon-loss errors and boosts the coherence time of the bosonic qubit by over a factor of two. Notably, QEC is realized in a modest hardware setup with neither high-fidelity readout nor fast digital feedback, in contrast to the technological sophistication required for prior QEC demonstrations. Compatible with additional phase-stabilization and fault-tolerant techniques16,17,18, our experiment suggests quantum dissipation engineering as a resource-efficient alternative or supplement to active QEC in future quantum computing architectures.