Audacity stops recording randomly

I’ve been using Audacity on Windows 11 for several months with a different issue (may or may not be related) but it was minor enough that I just ignored it for the most part. But just last week this problem started. The recording will randomly stop while running. Sometimes it gives an error message that says I’m running low on memory (which is false, memory usage was at 39% when I monitored it during one of these stops) but most of the time it just stops without giving an error message of any kind.

Regarding a similar issue that comes up when I try to Google this, I do not have sound activated recording enabled.

My other issue that may or may not be related: whenever I try to start recording, I get either a “-9997 invalid sample rate” error, or a “-9998 invalid number of channels” error. I have to go into the settings and tweak things around, and the same set of settings won’t guarantee that it works again next time. I’ve used the Windows Control Panel to make sure that the audio interface, my PC, and Audacity are all using the same sample rate settings but regardless this happens nearly every time.

to make sure that the audio interface
Maybe you’ve got a flaky USB cable or connection?

If it happens frequently enough that you can tell it’s working or not, and if you’re on a laptop, try making a long recording with the built-in mic.