If you received a distribution during the year from your HSA due to a mistake (reasonable cause), you may repay the mistaken distribution no later than April 15 of the following year you knew or should have known the distribution was a mistake.
Example: If you believed (but were mistaken) that an expense was a qualified medical expense and were reimbursed the cost from the HSA. You may then repay the mistaken distribution to the HSA.
In this situation, the mistaken distribution is not included in gross income and is not subject to the 20% additional tax. The repayment is not subject to tax on excess contributions.