The rectifying invoice must be issued as soon as we become aware of the circumstance that compels us to issue it. In any case, within 4 years from the time you accrue VAT.
In the special case of the rectifying invoice to recover VAT from an unpaid invoice, the period is 3 months from the date on which the requirements to be able to issue it are met.