Method for producing 4-formylaminopiperidine derivatives of the formula (I)and also the acid addition salts of these compounds, comprising the reaction of 4-aminopiperidine derivatives of the formula (II) or the acid addition salts of these compoundsin the presence of compounds of the formula (III)and the use of 4-formylaminopiperidine derivatives of the formula (I) produced in such a way for protecting inanimate organic material against the effect of light.