Troubleshooting Guide: SQL Server Error 10302 – “Could not get path for SQL Server: ‘%ls'”
Why This Error Happens
This error typically occurs when SQL Server 2025 is unable to resolve or access the file system path referenced in the registry or configuration metadata, often due to corrupted registry keys under the instance’s Setup hive. It can also happen when the SQL Server service account lacks the necessary NTFS permissions to read the installation directory, or when a prior failed patch/upgrade left the SQLPath, SQLBinRoot, or SQLDataRoot registry values pointing to a non-existent or relocated directory. Additionally, this can surface when Windows Server 2025 security policies (such as newly enforced path virtualization or Controlled Folder Access) block the SQL Server process from resolving the path at runtime.
Step-by-Step Resolution Guide
Step 1: Verify the SQL Server Installation Path in the Registry
- Open
regeditand navigate toHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL17.<InstanceName>\Setup. - Confirm that the
SQLPath,SQLBinRoot, andSQLDataRootvalues point to valid, existing directories (e.g.,C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL). - If any path is blank, malformed, or points to a deleted folder, this is the root cause — do not edit manually yet; proceed to repair instead.
Step 2: Check NTFS Permissions on the SQL Server Directories
- Right-click the SQL Server installation folder (typically
C:\Program Files\Microsoft SQL Server\) and open Properties > Security. - Ensure the service account (e.g.,
NT Service\MSSQLSERVERor your custom domain service account) has Read, Write, and Modify permissions. - Run the following PowerShell command to reapply inherited permissions if needed:
icacls "C:\Program Files\Microsoft SQL Server" /reset /T /C
Step 3: Run SQL Server Setup Repair
- Launch SQL Server Installation Center from the Start Menu.
- Select Maintenance > Repair, then choose the affected instance.
- Allow the repair wizard to rebuild missing registry path entries and restore binary/data root references automatically.
Step 4: Check Controlled Folder Access and Windows Defender Exclusions
- Open Windows Security > Virus & threat protection > Manage settings > Controlled folder access.
- Add
sqlservr.exeand the SQL Server data/log directories as allowed applications/exclusions. - Restart the SQL Server (MSSQLSERVER) service after applying exclusions.
Step 5: Restart the SQL Server Service and Validate Startup
- Open SQL Server Configuration Manager.
- Right-click the affected instance and select Restart.
- Monitor the SQL Server Error Log (
ERRORLOGin theLogfolder) for confirmation that the path resolves correctly on startup.
Alternative or Verification Steps
- Run
SELECT SERVERPROPERTY('InstanceDefaultDataPath')andSELECT SERVERPROPERTY('InstanceDefaultLogPath')in SQL Server Management Studio to confirm the paths now resolve without error. - If the issue persists after repair, uninstall and reinstall the specific SQL Server instance using a clean installation path, ensuring no legacy registry remnants remain (use the Microsoft SQL Server Uninstall Cleanup Utility beforehand).