If your Nintendo code says it cannot be used there are a few possible reasons. Common causes and fixes:
Wrong region — Nintendo codes are region locked and can only be redeemed on a Nintendo Account set to the same region as the code. Check your account region at accounts.nintendo.com → Profile → Country/Region. A US code will not work on a European account and vice versa.
Wrong platform — if you see the message "This is a Nintendo Switch 2 download code" it means the code is intended for Nintendo Switch 2 and cannot be redeemed on the original Nintendo Switch. Make sure the code matches your console.
Code must be redeemed in-game — some codes (such as DLC bonus codes or promotional codes) cannot be redeemed through the Nintendo eShop and must be entered directly within the game itself. Check the packaging or documentation that came with the code for redemption instructions.
Too many failed attempts — if you have entered an incorrect code too many times in a short period you may receive error 2811-6058 which temporarily blocks further attempts. Wait 15-30 minutes before trying again.
Code expired — some Nintendo codes have an expiration date. Check any documentation or email that came with the code to confirm it is still valid.
Account issue — make sure you are signed into the correct Nintendo Account and that your account is in good standing with no restrictions.