Remote Desktop error code 0x4: "An internal error has occurred"
Error 0x4 is a generic Remote Desktop failure: the connection could not be made or was dropped, and the host gave no reason. Microsoft does not document this code on its own, so work through the host-side checks first (services, listener, port, RDP certificate).
On this page
What it means
The full message usually reads "An internal error has occurred. Error code: 0x4, Extended error code: 0x0". In practice it means the connection failed or dropped and the other side did not say why. The extended code 0x0 confirms that no extra detail came back.
I could not find an official Microsoft page that explains 0x4 by itself, so there is no single documented cause. The order below follows Microsoft's general Remote Desktop troubleshooting article first, then community reports. Steps that come only from community threads are marked as unverified.
If your message shows a different code, see RDP error: how to tell which one you have. For the similar "couldn't connect" message, see Remote Desktop error 0x204.
Symptoms and causes
You are likely dealing with this problem if:
- The connection fails right after you click Connect.
- An established session drops unexpectedly (for example after a network failure), and the same host then refuses new connections.
- Only one client or one host is affected: another PC on the same network connects fine.
The usual causes, most common first:
- Problem with the host's RDP certificate or key
- The self-signed RDP certificate may be invalid, the bound thumbprint may be wrong, or the MachineKeys folder may have bad permissions or be corrupted. A Microsoft Q&A thread points this way, though many users there still reported the problem afterwards.
- Network or firewall trouble
- TCP port 3389 blocked, an unstable connection, or another application occupying the port.
- Broken listener or stopped service
- The rdp-tcp listener is missing or damaged, or the Remote Desktop Services service (TermService) is not running.
- Security layer or NLA negotiation
- Suggested in community threads but never confirmed as a cause.
How to fix it
Work through these in order. They start with the quickest, safest checks and move to deeper repairs; stop as soon as the problem is gone.
1.Check the services, listener and RDP policy on the host
Microsoft's general RDP troubleshooting starts here: a stopped service, missing listener or policy block produces vague errors like this one.
- On both the client and the host, make sure the services TermService and UmRdpService are running (Services app, WinR,
services.msc). - On the host, open an elevated Command Prompt and check that
rdp-tcpshowsListen.qwinsta - Check that
fDenyTSConnectionsis 0 underHKLM\SYSTEM\CurrentControlSet\Control\Terminal Server. Read it only; no change is needed if it is already 0. - Look for a Group Policy that blocks RDP. Generate a report, open it, and find the policy Allow users to connect remotely by using Remote Desktop Services.
gpresult /H c:\gpresult.html
2.Check port 3389 and the network path
If something else holds the port, or a firewall drops the traffic, the session can fail with no detail.
- On the host, check that port 3389 is listening.
netstat -ano | find "3389" - If another process owns the port, find it by its PID (the last number on the line).
tasklist /svc | find "<PID>" - From a different machine, test whether the port is reachable with Sysinternals PsPing. A failure points to a firewall or network block between the two.
psping -accepteula <host IP>:3389 - If a different application is using 3389, move that application to another port rather than changing the RDP listener.
3.Reset the RDP self-signed certificate on the host
Microsoft lists a bad RDP certificate as a cause of connection failures, and a community thread on 0x4 points the same way.
Before you start: Create a restore point first. Only delete the certificate under the Remote Desktop store, nothing else.
- On the host, press WinR, type
certlm.mscand press Enter (Computer account store). - Open Remote Desktop > Certificates and delete the RDP certificate.
- Restart the Remote Desktop service in an elevated PowerShell.
Restart-Service TermService -Force - Check that a new certificate appeared under Remote Desktop.
- If it did not, open the folder
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys, go to its Security properties, and make sureBuiltin\Administratorshas Full control andEveryonehas Read and Write (the permissions Microsoft's article lists). Then restart TermService again.
4.Check which certificate RDP is bound to (unverified community step)
A community answer says a bad bound thumbprint can cause 0x4.
Before you start: Community suggestion with few votes, not confirmed by Microsoft. Note the current value before changing anything. wmic is deprecated and missing from recent Windows 11 builds, so this may not work there.
- Read the current thumbprint.
wmic /namespace:\\root\cimv2\TerminalServices PATH Win32_TSGeneralSetting Get SSLCertificateSHA1Hash - Compare it with a certificate in the computer's Personal store (
certlm.msc). If it points to a certificate that does not exist, the community answer is to set a valid thumbprint (typed without spaces) and restart TermService.
5.Rebuild the RDP listener if rdp-tcp is not listening
Microsoft documents this for a missing or damaged listener, which qwinsta reveals.
Before you start: Registry edit. Create a restore point and back up the existing key before deleting it. Use an export only from a working machine with the same Windows version.
- On a working machine of the same OS version, export
HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcpto a .reg file. - On the broken host, export the existing RDP-Tcp key as a backup, then delete it.
- Import the .reg file from the working machine, then restart the service.
Restart-Service TermService -Force - If it still fails, reboot the host.
6.Temporarily test with NLA off (unverified, diagnostic only)
A community answer suggested a security-layer mismatch. It was not confirmed to help.
Before you start: Turning off NLA lowers security. Use it only to test, then turn it back on.
- On the host, open Group Policy and go to Remote Desktop Session Host > Security.
- Set the security layer to RDP and disable Require user authentication for remote connections by using Network Level Authentication, then test.
- Re-enable NLA afterwards whatever the result.
7.Last resort: rename the MachineKeys folder (unverified)
This was a widely upvoted answer in a Microsoft Q&A thread. It is anonymous and not verified by Microsoft, and many users there said it did not solve the issue.
Before you start: It can break other services that use certificates; the poster says IIS certificates may need re-importing. Back up the folder and create a restore point first. Try this only after the earlier steps.
- Copy
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeysto a safe backup location. - Rename the original folder (for example to
MachineKeys.old), then reboot the host and test the connection.
Check that it worked
- Connect again with Remote Desktop and reach the sign-in screen without error 0x4.
- On the host,
qwinstashowsrdp-tcpin theListenstate. - The session stays connected for several minutes and a second connection attempt also works.
If it still fails
- Try a different or newer Remote Desktop client, or roll back to the previous client version.
- Check whether a different device on the same network connects to the same host. That tells you whether the problem is the host or your PC.
- Collect the error text, the client and Windows versions, and the results of
qwinstaand the port test, then open a support case with Microsoft.
Questions
Does the extended error code 0x0 mean anything?
It means the server returned no extra detail, which is why 0x4 has no single explanation.
Sources
- General Remote Desktop connection troubleshooting - Windows ServerOfficial · Microsoft Learn
- Windows Remote Desktop Client fails to connect with error code 0x4 on only one of my computers · Microsoft Q&A
- Unexpected disconnection of remote desktop. Unable to use remote desktop. Error code: 0x4 · Microsoft Q&A