This could happen if you are trying to record stereo on a mono track, for example.
I was recording mono on a mono track.
Have you tried switching MME and DirectSound to WASAPI
Yes, when I used WASAPI I got a different error: Error code recording device. Error code: -9997 Invalid sample rate
Updated:
Figured out that I had to go into Windows sound settings and change the frequency setting for Line in both Input/Output. They were using two different frequencies and not matching to what I had set in Audacity.