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

Troubleshooting Guide: SQL Server Error 2578 – JSON Column Corruption

Why This Error Happens

Error 2578 occurs when SQL Server’s native JSON data type (introduced in SQL Server 2025) detects that the binary-encoded JSON stored in a column no longer conforms to the expected internal structure. This typically happens due to physical page-level corruption caused by storage subsystem failures, improper shutdowns, or disk I/O errors, or because the data was written by a non-transactional process (such as a direct bulk load or replication conflict) that bypassed JSON validation. In rarer cases, this can also result from a corrupted database backup being restored over a healthy data file.

Step-by-Step Resolution Guide

Step 1: Identify the Scope of Corruption

  • Run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm whether the corruption is isolated to the JSON column or indicates broader page-level damage.
  • Note the specific Row ID (RID) and table ID provided in the error message (e.g., (%d:%d:%d)) to pinpoint the exact data page.
  • Check the SQL Server Error Log (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for accompanying I/O or storage warnings around the same timestamp.

Step 2: Isolate and Attempt to Recover the Affected Row

  • Query the specific row using the identifiers from the error message: SELECT * FROM YourTable WHERE %ls (using the predicate provided in the error).
  • Attempt to cast the column to NVARCHAR(MAX) to inspect the raw string: SELECT CAST(JsonColumn AS NVARCHAR(MAX)) FROM YourTable WHERE id = X;
  • If the data is readable but malformed, attempt a manual fix using ISJSON() to validate before updating: UPDATE YourTable SET JsonColumn = '{}' WHERE ISJSON(JsonColumn) = 0 AND id = X;

Step 3: Restore from a Clean Backup (If Data is Unreadable)

  • If the row data is unrecoverable via direct query, restore the specific table or database from the last known good backup using RESTORE DATABASE YourDatabaseName FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE;
  • For Always On Availability Groups, consider failing over to a secondary replica to retrieve a non-corrupted copy of the row before re-syncing.
  • If backups are unavailable, use DBCC CHECKTABLE with the REPAIR_ALLOW_DATA_LOSS option as a last resort, understanding this may delete the corrupted row entirely: DBCC CHECKTABLE ('YourTable', REPAIR_ALLOW_DATA_LOSS);

Step 4: Validate Underlying Hardware and Storage

  • Check Windows Server 2025 Event Viewer under Windows Logs > System for Disk or NTFS warnings that might indicate a failing physical drive.
  • Run chkdsk D: /f /r (replacing D: with your data drive) during a maintenance window to repair underlying file system errors.
  • Verify that Storage Spaces Direct (if applicable) is reporting a healthy status via Get-VirtualDisk in PowerShell.

Alternative or Verification Steps

  • After applying the fix, re-run SELECT ISJSON(JsonColumn) FROM YourTable WHERE id = X; and confirm the result returns 1 (valid), rather than 0 or NULL.
  • If the error persists only on specific rows, consider using OPENJSON with a WITH schema clause to attempt a structured re-insertion of the data into a new, verified column before dropping the old one.