In my previous house, I added a 50A electrical subpanel for my basement workshop. I tend not to get permits for DIY projects, so I'm very meticulous and have never had any issues. What I failed to consider this time, however, was the wall itself. When we sold 15 years later, the buyer's home inspector looked at other parts of the basement and was able to determine that the wall was not original, and the unpermitted panel in that wall therefore must not be original either. Busted!
I wasted half a day and spent well over $100 to apply for a permit after-the-fact. Once the county had my check, the rest was easy. Their code inspection lasted only four minutes! I passed.
Additions and modifications aren't grandfathered like the house itself. If there are suspected issues with an unpermitted change, the inspector can require drastic measures such as tearing open walls, etc. to verify that the entire project is in compliance with current codes, not the ones in force when the work was accomplished. I was lucky. The next time I play this poker game, I'll pay more attention to "tells."
I hope my experience will make someone else's life easier.