Troubleshooting Guide: SQL Server Error 1921 — “Invalid %S_MSG ‘%.*ls’ specified”
Why This Error Happens
Error 1921 typically occurs when SQL Server 2025 encounters a malformed or unrecognized message parameter during a DDL operation, most commonly when altering a resource governor pool, index rebuild operation, or configuration setting with an invalid identifier or option name. This is frequently triggered by corrupted system metadata, a mismatched collation between the client tool and server instance, or a Windows Server 2025 locale/regional setting conflict that garbles the string substitution in the error message template. In some cases, this surfaces after an in-place upgrade from SQL Server 2022 where cached execution plans or system catalog views reference deprecated syntax that the new engine cannot parse correctly.
Step-by-Step Resolution Guide
Step 1: Verify the Exact Command Syntax
- Re-run the failing T-SQL statement in isolation within SQL Server Management Studio (SSMS) 21 or Azure Data Studio.
- Check for invisible Unicode characters or copy-paste artifacts, especially if the script originated from a PDF or web source.
- Confirm option names (e.g.,
MAXDOP,WAIT_AT_LOW_PRIORITY,DATA_COMPRESSION) match the exact casing and spelling expected by SQL Server 2025’s updated syntax reference.
Step 2: Clear Procedure Cache and Validate System Catalogs
- Run
DBCC FREEPROCCACHEto eliminate stale execution plans left over from a prior version. - Execute
DBCC CHECKCATALOG('YourDatabaseName')to rule out metadata corruption in system tables. - Restart the SQL Server service via Services.msc or
net stop MSSQLSERVER && net start MSSQLSERVERon Windows Server 2025.
Step 3: Check Collation and Locale Settings
- Open
Control Panel > Clock and Region > Region > Administrative > Change system localeon both the Windows 11 client and Windows Server 2025 host. - Ensure the OS locale matches the SQL Server instance collation (
SELECT SERVERPROPERTY('Collation')). - If mismatched, reinstall or reconfigure the instance collation using the SQL Server 2025 Installation Center under
Maintenance > Edit Instance Collation.
Step 4: Apply Latest Cumulative Update
- Navigate to the Microsoft Update Catalog and download the latest Cumulative Update (CU) for SQL Server 2025.
- Install via
C:\SQLServer2025\Setup\setup.exe /ACTION=Patch /INSTANCENAME=MSSQLSERVER /IACCEPTSQLSERVERLICENSETERMS. - This resolves known message-template bugs documented in early 2025 RTM builds.
Step 5: Rebuild the Affected Object
- If the error targets a specific index, stored procedure, or resource pool, drop and recreate the object using freshly generated DDL from
sp_helptextor SSMS scripting wizard. - Avoid reusing scripts generated by SQL Server 2022 tools, as syntax trees may be incompatible.
Alternative or Verification Steps
- After applying fixes, re-execute the original command and confirm it completes without the 1921 error, then check the SQL Server Error Log (
EXEC sp_readerrorlog) for confirmation. - If the issue persists, enable trace flag
3604and1921output viaDBCC TRACEON(3604, -1)to capture a more detailed internal message payload for Microsoft Support escalation.