Trouble installing basic RFID program on ESP32

Hello everyone, I’m trying to run a basic Version Dump program for an RFID-RC522 reader on my ESP-WROOM-32S. Here is the basic code:

#include <SPI.h>
#include <MFRC522.h>
 
const int resetPin = 17; // Reset pin
const int ssPin = 21;    // Slave select pin
 
MFRC522 mfrc522 = MFRC522(ssPin, resetPin); // Create instance
 
void setup() {
  Serial.begin(115200);
  SPI.begin();   
 
  mfrc522.PCD_Init();
  mfrc522.PCD_DumpVersionToSerial();  
 
}
 
void loop() {}

Here is the error message I am receiving:

serial.serialutil.SerialException: could not open port ‘COM6’: WindowsError(5, ‘Access is denied.’)
Failed to execute script esptool
the selected serial port Failed to execute script esptool
does not exist or your board is not connected

Now, I’ve already searched for other issues similar to these (most issues seem to be related to not having up to date libraries/drivers/or not having switched to the correct port), but here’s what gets me. I can run a different program on my ESP32 just fine using the COM6 port, and I can use the same program on my Arduino UNO using the RFID-RC522 without any problems (using COM3 in that case). I just can’t seem to combine the two. Any idea what I’m missing?

I was starting to encounter the same issues with other code that had previously worked. So I tried disconnecting and reconnecting the USB cord from both my PC and my ESP32 and that seems to have done the trick. I think I just had an unstable connection between the USB and ESP32.

Basically, just a standard twist on turning it off and on again. Sorry to throw up the red flag.