If you administer the RD Gateway server:
Some users have resolved 0x904 by switching from the built-in mstsc.exe to the modern app available in the Microsoft Store, which uses a different connection engine.
Right-click and any expired certificates listed there.
Resolving this error requires a systematic approach, as the cure depends on the cause. The first line of defense is clearing the local RDP license cache. On the client machine, deleting the MSLicensing registry key (under HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client ) forces the creation of a fresh license on the next connection. For many users, this single step resolves both codes immediately.