How to Fix OneDrive “Script Error” during Sign-in

A OneDrive “Script Error” during sign-in occurs when the embedded web browser component inside the OneDrive authentication wizard fails to execute JavaScript, load modern identity stylesheets, or parse redirect tokens from Microsoft Entra ID or your organization’s Single Sign-On (SSO) identity provider. The sign-in dialog freezes with a pop-up warning citing Line: [X], Char: [X], Error: Object doesn't support property or method, or a blank white window that blocks account configuration.

Fast Fix:
Clear legacy Internet Properties cache and reset security zones. Press Windows Key + R, run inetcpl.cpl, click the Advanced tab, and click Restore advanced settings. Next, go to the Security tab, select Reset all zones to default level, then clear cached browsing history under the General tab. Restart OneDrive and sign in again.

Diagnostic Snapshot

  • Direct Causes: Corrupted Microsoft Edge WebView2 Runtime or legacy WinINet cache, outdated TLS security protocol flags, strict Internet Explorer/Edge zone security scripts, or stale OAuth identity tokens.
  • Risk Level: Low. Your cloud data is untouched, but local synchronization cannot initialize until identity validation completes.
  • Scope: Client-side authentication rendering engine; OneDrive for Web remains fully accessible.

Why the “Script Error” Blocks Sign-in

The OneDrive desktop client does not host its own independent browser engine for login workflows. Instead, it embeds Windows web components (historically MSHTML/WinINet, and modernly the Microsoft Edge WebView2 Runtime) to render Microsoft 365 login pages, Multi-Factor Authentication (MFA) challenges, and SAML redirection portals.

This embedded browser pipeline breaks when:

  1. Script Execution Blocks in Windows Security Zones: If Windows Internet Properties security settings are set to restrict active scripting or block cross-domain redirects, the modern JavaScript framework driving Microsoft’s authentication endpoint halts mid-execution.
  2. Damaged WebView2 Runtime Environment: If the Microsoft Edge WebView2 Runtime is corrupt, outdated, or missing administrative permissions, the login window falls back to legacy components that cannot parse modern ECMAScript standards used by Microsoft login portals.
  3. Stale or Clashing Authentication Cookies: Cached session cookies from previous logins or competing Microsoft accounts prevent OAuth authorization tokens from resolving cleanly.

Step-by-Step Resolution Path

Follow these troubleshooting steps in order, moving from browser subsystem adjustments to runtime repairs and client resets.

1. Reset Windows Internet Options and Scripting Settings
Even on Windows 11, core authentication dialogs reference global Windows Internet Properties (WinINet):

  1. Press Windows Key + R to open the Run dialog box.
  2. Type inetcpl.cpl and press Enter.
  3. Go to the Security tab and click Reset all zones to default level.
  4. In the Trusted sites zone, click Sites, and ensure no broken proxy redirects are listed.
  5. Switch to the Advanced tab:
    • Click Restore advanced settings.
    • Scroll down to the Browsing section and check Disable script debugging (Internet Explorer) and Disable script debugging (Other).
    • Uncheck Display a notification about every script error.
    • Scroll down to the Security section and verify that Use TLS 1.2 and Use TLS 1.3 are enabled.
  6. Click Apply and then OK.

2. Clear Stale Windows Identity Credentials
If a previous sign-in attempt cached broken session tokens:

  1. Press Windows Key + S, type Credential Manager, and select Windows Credentials.
  2. Scroll down to Generic Credentials.
  3. Remove entries matching:
    • OneDrive Cached Credential
    • Microsoft_Office_16_Data:ADAL:
    • MS.OneDrive
  4. Close Credential Manager, restart the machine, and attempt to sign in to OneDrive again.

3. Repair or Reinstall Microsoft Edge WebView2 Runtime
A corrupted WebView2 engine causes embedded authentication frames to fail:

  1. Press Windows Key + I to open Windows Settings.
  2. Navigate to Apps > Installed apps.
  3. Search for Microsoft Edge WebView2 Runtime.
  4. Click the three dots next to it, select Modify, and choose Repair.
  5. If the repair option is unavailable, download the Evergreen Bootstrapper from Microsoft’s official WebView2 portal and run the installer with administrative rights.
  6. Once reinstalled, launch OneDrive and retry the login flow.

4. Reset the OneDrive Sync Client Engine
If corrupted local configuration records keep triggering the script loop:

  1. Press Windows Key + R to open the Run dialog.
  2. Enter the following reset command and press Enter:DOS %localappdata%\Microsoft\OneDrive\onedrive.exe /reset
  3. The OneDrive icon will close. Wait 2 minutes for it to restart. If it does not reappear automatically, run:DOS %localappdata%\Microsoft\OneDrive\onedrive.exe

Diagnostic Branching & Misdiagnoses

  • Gray Cloud Icon with No Login Prompt: If the script error disappears but the client remains in an unauthenticated or inactive state without prompting for credentials.
  • Client Crashes Immediately After Script Error: If clicking through the script error dialog causes OneDrive.exe to terminate unexpectedly on startup.
  • Setup Hangs on Loading Screen: If the sign-in succeeds but the setup wizard gets stuck preparing directories.

Escalation & Enterprise Admin Checks

  • Federated Identity & ADFS Forms Authentication: On enterprise networks utilizing Active Directory Federation Services (ADFS) or third-party Identity Providers (e.g., Okta, Ping Identity), verify that the organization’s custom login portal does not use unsupported JavaScript features or block CSS/JS assets via Content Security Policies (CSP).
  • SSL Inspection and Proxy Filtering: Corporate firewall proxies that perform SSL interception can break the secure handshake between the embedded browser and Microsoft Entra ID endpoints (login.microsoftonline.com). IT administrators should confirm that Microsoft 365 authentication URLs bypass SSL inspection.
  • Group Policy Scripting Restrictions: If an Intune or GPO configuration has disabled JavaScript execution across local zones (URLACTION_SCRIPT_RUN), policy overrides must be adjusted by an administrator.