Unpermitted work is common in older stock. A converted garage is the classic case.
A sale is still possible. It affects financing more than value, because lenders care about what the records show.
Start at the county with the permit file. It is better to read about permits it than argue about it, and disclosure follows from it.
Retroactive permits range widely. Price it before committing, or price it in and move on.