Retirement tax questions

When doing 2021 taxes, fidelity gave me a word document stating the earnings from the excess contributions that I'd have to report.  I didn't receive the actual 1099-R though until now for 2022.  My excess contribution earnings on the 1099-R had code PJ - so i properly reported for 2021.   But my spouse's 1099-R had code 8J meaning it should be into 2022, but i had put that in my 2021 earnings.  So I'm guessing i need to amend 2021 to remove those earnings as they should go into 2022.  

 

I guess the challenge was i didnt know which year the earnings were going to go until the 1099-R actually comes out the next year.

@fanfare