How to fix Error 3816 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3816 – Login Password Hash Invalid During SQL Server Upgrade

Why This Error Happens

This error occurs when SQL Server attempts to upgrade a login and discovers that the stored password hash does not conform to the expected cryptographic format, typically because the login was created or migrated from a very old SQL Server version (pre-2012) using legacy hashing algorithms. It can also occur if the sys.sql_logins system table has corrupted or manually altered password hash data. SQL Server 2025 enforces stricter validation on login credentials during the upgrade process, causing logins with malformed or outdated hashes to fail rather than silently upgrading them.

Step-by-Step Resolution Guide

Step 1: Identify the Affected Login

  • Before upgrading, run the following query on the source instance to detect problematic logins:
  • SELECT name, type_desc, LEN(password_hash) AS hash_length FROM sys.sql_logins;
  • Look for logins with NULL, empty, or unusually short/long password_hash values compared to other standard logins.
  • Cross-reference the login name reported in the error message (%.*ls) with this result set.

Step 2: Reset the Password for the Affected Login

  • Connect to the SQL Server instance using SQL Server Management Studio (SSMS) or sqlcmd with an account that has ALTER ANY LOGIN permission.
  • Run the following T-SQL command to force a password reset and regenerate a valid hash:
  • ALTER LOGIN [LoginName] WITH PASSWORD = 'NewStrongP@ssw0rd123';
  • If the login is disabled or orphaned, first enable it using ALTER LOGIN [LoginName] ENABLE; before resetting the password.

Step 3: Validate Password Policy Compliance

  • Ensure the new password meets Windows Server 2025 security baseline policies by checking Local Security Policy (secpol.msc) under Account Policies > Password Policy.
  • If the login must retain SQL Server 2000/2005 compatibility hashing temporarily, avoid using the CHECK_POLICY = OFF flag long-term, as this will cause the same error on the next upgrade attempt.
  • Re-run the hash length query from Step 1 to confirm the password_hash column now returns a standard 2008-bit (or later) formatted hash.

Step 4: Re-Run the SQL Server Upgrade Process

  • Launch SQL Server Setup (setup.exe) again from the installation media or mounted ISO on your Windows Server 2025 host.
  • Select Upgrade and proceed through the wizard; the setup will re-validate all logins in the master database.
  • Monitor the detailed upgrade log located at %ProgramFiles%\Microsoft SQL Server\160\Setup Bootstrap\Log\Summary.txt for confirmation that Error 3816 no longer appears.

Alternative or Verification Steps

  • Verify the Fix: After the upgrade completes, log in using the affected credentials via SSMS or sqlcmd -S servername -U LoginName -P NewPassword to confirm authentication succeeds without errors.
  • Alternative Solution: If resetting the password is not feasible (e.g., third-party application dependencies), drop and recreate the login entirely using CREATE LOGIN [LoginName] WITH PASSWORD = 'P@ssw0rd', SID = <original_sid>; to preserve object ownership mappings while generating a compliant hash.