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

Troubleshooting Guide: SQL Server Error 5835 — “Failed to start CPUs with the mask 0x%lx on the system”

Why This Error Happens

This error occurs when SQL Server 2025 attempts to bind its scheduler threads to specific CPUs during startup based on an affinity mask configuration (via sp_configure or ALTER SERVER CONFIGURATION), but the Windows Server 2025 / Windows 11 kernel reports that those logical processors are unavailable, disabled, or do not exist on the current hardware/VM topology. This commonly happens after a VM is reconfigured with fewer vCPUs, a physical CPU is swapped, a NUMA node is removed, or a BIOS/hypervisor setting restricts the processor group exposed to the OS, leaving a stale affinity mask in the SQL Server configuration that references non-existent CPUs. It can also arise from corrupted or mismatched soft-NUMA configuration files referenced by startup parameters.

Step-by-Step Resolution Guide

Step 1: Identify the Current CPU Topology

  • Open an elevated PowerShell prompt and run Get-WmiObject Win32_Processor | Select-Object NumberOfCores, NumberOfLogicalProcessors.
  • Cross-check this against Task Manager > Performance > CPU to confirm the actual number of logical processors exposed to the OS.
  • Compare this to the CPU affinity mask currently configured in SQL Server.

Step 2: Reset the SQL Server Affinity Mask

  • Start SQL Server in minimal configuration mode by launching it from the command line with the -f flag, e.g., sqlservr.exe -f -c from the C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn directory.
  • Once connected via SQLCMD or SSMS, run EXEC sp_configure 'show advanced options', 1; RECONFIGURE; followed by EXEC sp_configure 'affinity mask', 0; RECONFIGURE; to clear the stale mask.
  • Alternatively, reset affinity via ALTER SERVER CONFIGURATION SET PROCESS AFFINITY CPU = AUTO; to let SQL Server auto-detect available CPUs.

Step 3: Validate Soft-NUMA and Startup Parameters

  • Check the SQL Server error log directory (default: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log) for any -K or NUMA-related startup trace flags that may reference removed CPU nodes.
  • Open SQL Server Configuration Manager, navigate to SQL Server Services > right-click the instance > Properties > Startup Parameters, and remove any manually added affinity or NUMA startup flags that no longer match hardware.
  • Restart the SQL Server service normally (not in -f mode) via Restart-Service MSSQLSERVER -Force.

Step 4: Update Hypervisor/VM CPU Allocation (If Applicable)

  • If running on Hyper-V or another hypervisor, confirm the VM’s assigned vCPU count matches what SQL Server expects by checking VM Settings > Processor in Hyper-V Manager.
  • Increase vCPU count or re-enable disabled cores if the mask requires more processors than currently assigned.

Alternative or Verification Steps

  • After restarting the service, verify success by checking the SQL Server error log for the message “SQL Server detected X sockets with Y cores per socket” without any accompanying 5835 error.
  • If the issue persists, run DBCC CPU (or query sys.dm_os_schedulers for status = 'VISIBLE ONLINE') to confirm all expected schedulers are active and match the physical/virtual CPU count.