Contributing to a Roth IRA at your first opportunity each year is a great way to save for retirement. Roth IRAs allow most taxpayers to save on a tax-free basis for their long-term financial goals, but they're only available for people earning up to a certain amount of income each year. Many people make Roth contributions early in the year before they know for sure how much income they'll earn, and if they get an unexpected bonus, it can send them over the limit. Fortunately, there's a way to undo your earlier Roth contribution in that scenario in order to avoid big penalties. The challenge with Roth IRAs Roth IRAs let most working taxpayers contribute up to $5,500 toward retirement savings if they're younger than age 50, or $6,500 if they're aged 50 or older (as of 2017). There are also a couple of added restrictions. You cannot contribute more money than you've earned in a given year, so if your earned income is less than the maximum contribution, you'll be limited to the amount of your earnings. Income limits also apply to Roth IRA contributions. Once your modified adjusted gross income climbs above a certain amount, you can contribute only part, but not all, of the maximum contribution for your age group. Above a certain income threshold, you're no longer allowed to make Roth contributions at all. The chart below shows the relevant income limits for 2017. Filing Status Contributions Reduced if Income Exceeds This Amount Contributions Not Allowed if Income Exceeds This Amount Single, head of household, or married filing separately IF you didn't live with your spouse during the year $118,000 $133,000 Married filing jointly or qualifying widow or widower $186,000 $196,000 Married filing separately IF you lived with your spouse at any point during the year $0 $10,000 Data source: IRS. For most workers, the income limits are relatively straightforward, because salaried employees generally know what their income will be for the year. Yet some taxpayers, such as business owners and employees who get paid on commission, can see wide variations in compensation from year to year. An unexpected windfall can push your income higher than you expected, and if you already made Roth contributions earlier in the year, you might suddenly find that you're over the limit and in danger of violating the IRS guidelines for contributing to your retirement account. If you do nothing, then you've made what's known as an "excess contribution," and the IRS will impose a penalty. The amount will be 6% of the amount that you incorrectly contributed, payable each year until you correct the situation. Even though 6% doesn't sound like much, it can easily be more than the income that the contributed amount produces annually. Image source: Getty Images. What to do There are several things you can do to correct an excess contribution. The simplest is to withdraw the excess amount before the tax filing deadline for the year in which you made the contribution. So if you made an excess contribution in 2017, you'd have until mid-April 2018 to withdraw it without owing penalties -- or mid-October 2018 if you file for an automatic six-month extension. Another option is to recharacterize the Roth contribution as a traditional IRA contribution. Traditional IRA contributions are not restricted based on income; their income limits only affect whether you can deduct those contributions on your tax return. You can arrange for your Roth IRA provider to transfer the excess money to a traditional IRA, either at the same institution or at a different one. The transfer must occur before the tax return deadline of the tax year in question. Whether you pick the simple withdrawal method or the recharacterization option, you also have to move the net income that the excess contribution generated while it was in the Roth IRA. So if you contributed $6,000, and it generated $120 in income before you moved it out, then you'll have to arrange to withdraw or recharacterize a total of $6,120. Finally, if you missed fixing the problem until after your tax return was done, you still have options. If you withdraw the excess in a later year, then you'll stop the clock running on additional penalties. Alternatively, you can simply contribute less than the maximum in a subsequent year. With these two strategies, though, you won't avoid penalties in the tax year during which you made the original excess contribution. Roth IRAs can be complex, and there are traps for the unwary. However, you shouldn't let fear of unpredictable income stop you from making Roth IRA contributions, because you can always take action to fix the problem without adverse consequences. The $16,122 Social Security bonus most retirees completely overlook If you're like most Americans, you're a few years (or more) behind on your retirement savings. But a handful of little-known "Social Security secrets" could help ensure a boost in your retirement income. For example: one easy trick could pay you as much as $16,122 more... each year! Once you learn how to maximize your Social Security benefits, we think you could retire confidently with the peace of mind we're all after. Simply click here to discover how to learn more about these strategies. The Motley Fool has a disclosure policy.