SQLSTATE[HY000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The operating system returned error 38(Reached the end of the file.) to SQL Server during a read at offset 0x0000b081cbc000 in file 'D:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\DB_v4.mdf'. Additional messages in the SQL Server error log and operating system error log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately.

I have following error after restarting the database server. The main page that contains dropdown and select from the database is working, but will give an error when I try to save/login.

I try to query on SSMS, can login to database, and can perform query SELECT TOP 100, but if I try to INSERT/COUNT it gives an error:

Error: 823, Severity: 24, State: 2.

  • 4
    see if you get errors with DBCC CHECKTABLE, this problem is hardly related to laravel. something is horribly wrong with your sql server. perhaps power outage? disk issue?
    – Bagus Tesa
    Commented Dec 11, 2023 at 7:03
  • "Additional messages in the SQL Server error log and operating system error log may provide more detail." You forgot to include these findings.
    – Thom A
    Commented Dec 11, 2023 at 9:15

1 Answer 1


Here's some documentation regarding error 823:


The 823 error message usually indicates that there is a problem with underlying storage system or the hardware or a driver that is in the path of the I/O request. You can encounter this error when there are inconsistencies in the file system or if the database file is damaged. In the case of a file read, SQL Server will have already retried the read request four times before it returns 823. If the retry operation succeeds, the query will not fail but message 825 will be written into the ERRORLOG and Event Log.

The docs mention the following on resolving it:

User Action

  • Review the suspect_pages table in MSDB for other pages that are encountering this problem (in the same database or different databases).

  • Check the consistency of databases located on the same volume (as the one reported in the 823 message) using DBCC CHECKDB command. If you find inconsistencies from the DBCC CHECKDB command, use the guidance from How to troubleshoot database consistency errors reported by DBCC CHECKB.

  • Review the Windows Event logs for any errors or messages reported from the Operating System or a Storage Device or a Device Driver. If they are related to this error in some manner, address those errors first. For example, apart from the 823 message, you may also notice an event like "The driver detected a controller error on \Device\Harddisk4\DR4" reported by the Disk source in the Event Log. In that case, you have to evaluate if this file is present on this device and then first correct those disk errors.

  • Use the SQLIOSim utility to find out if these 823 errors can be reproduced outside of regular SQL Server I/O requests. The SQLIOSim utility ships with SQL Server 2008 and later versions so there is no need for a separate download. You can typically find it in your C:\Program Files\Microsoft SQL Server\MSSQLxx.MSSQLSERVER\MSSQL\Binn folder.

  • Work with your hardware vendor or device manufacturer to ensure

    • The hardware devices and the configuration conforms to the I/O requirements of SQL Server
    • The device drivers and other supporting software components of all devices in the I/O path are up to date
  • If the hardware vendor or device manufacturer provided you with any diagnostic utilities, use them to evaluate the health of the I/O system

  • Evaluate if there are filter drivers that exist in the path of these I/O requests that encounter problems.

    • Check if there are any updates to these filter drivers
    • Can these filter drivers be removed or disabled to observe if the problem that results in the 823 error goes away

In short, you may have a corrupt disk or database. You should use DBCC CHECKDB to verify for corruption and potentially remediate it. You may need to migrate your database to a new disk.

And here's some additional helpful information from Sean:

The OS error returned is 38 (reached the end of the file) so it looks like there may be filesystem level corruption that has occurred (or 3rd party drivers, potentially). There should be no reason why the filesystem returns 38 when a read\write of the offset happens unless the filesystem metadata is incorrect or the read/write location is incorrect. I have a hard time believe SQL Server is generating the location incorrectly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.