Hello,
Welcome to Microsoft Q&A,
This issue is usually caused by a site user ID mismatch.
This issue most frequently occurs if a user account is deleted in the Microsoft 365 admin center or in Active Directory (in directory synchronization scenarios), and the account is then re-created by using the same user principal name (UPN) but a different ID value. When the user tries to access a site collection or OneDrive, the user has an incorrect ID.
A second scenario involves directory synchronization with an Active Directory organizational unit (OU). This issue might occur if a user has already signed in to SharePoint and then is moved to a different OU and resynced with SharePoint.
Resolution
To fix the issue, check whether a new UPN exists. If it does, delete the new UPN, and then restore the original UPN.
If you're not comfortable with using this procedure, see Fix site user ID mismatch in SharePoint or OneDrive for an automated solution to fix the issue.
https://learn.microsoft.com/en-us/troubleshoot/sharepoint/sync/sign-into-onedrive-error-0x8004e4d0
Please Upvote and accept the answer if it helps!!