XRPcode IDE give error: "Opening port failed, is another application accessing this device/port?"

When trying to connect the XRP robot to the IDE, it throws this error “Opening port failed, is another application accessing this device/port?” and does not let me connect.
My best guess so far is that the code just starts running, or is running before I try to connect and that is why is considered to be being used by another application/process, but because I can’t connect I can’t stop it.

I don’t know if this is related, but when I power on the robot when it is plugged with a micro USB into my computer, it runs what I assume to be one of the example projects that sets the servo to 90deg (straight up and down), but then does nothing if I power on the robot, and do not plug it in. The first time I power it on after plugging it in, the Pico’s green light flashes for a bit, turns off and then runs the program.

This is my first time messing with this robot (though it’s probably most people’s), but also my first time messing with a Pico, so any help would be appreciated.

Normally the IDE (XRPCode) will connect to the XRP whether or not it is running a program. XRPCode will stop the running code when it connects. Also the code running on the XRP should act the same whether it is connected to the USB or running on batteries, unless the batteries are low. The default program on the PicoW should just keep blinking the green LED.
The odd behavior with the servo makes me think that something is not wired correctly. You should check the servo, the range finder, and the line follower to make sure that they are wired properly.
The other reason that you would get that error is if the browser (needs to be Chrome or Edge) has another window that is trying to attach to a USB connection. The most common would be two tabs or windows are open and both are connected to XRPCode.
Please let us know if the problems persist after trying these suggestions.

I did have it working before, and none of the wiring has changed, so I don’t think that’s the problem. The rangefinder is not attached to the robot at the moment because I misplaced the mount for it, but like I said it was working before so this shouldn’t be a problem.

And for your comment on having multiple instances of the XRPCode open, I double-checked that there was only one, and the issue persists.

Another thing I forgot to mention is that it’s also showing up with a drive called PicoDisk even when I connect it without ding the whole RESET+BOOTSEL button thing, and even when I do that, it shows a drive with a different name. I don’t think it was doing this before and/or if it’s normal.

I’m also using Ubuntu if that changes anything.

Ok, I solved the problem, it was because I was using Linux. You need to add your user as a dialout. I was just running into the issue of the error telling me something completely different from the actual issue.

I used this command:
sudo adduser {insert username here} dialout

and then you need to reboot your computer after, problem solved.