How to Fix SQL Server Error 41365 (Msg 41365)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see sql server error 41365 when the database engine skips a checkpoint file merge. To fix it, let background merges finish and check disk space before retrying. This message carries severity level 16 in the database engine. It warns your team that a merge request for a transaction range did not run. The checkpoint files for that range could not merge at that moment. Your data remains safe, and the engine keeps running normal queries. What causes sql server error 41365 in the database engi

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You see sql server error 41365 when the database engine skips a checkpoint file merge. To fix it, let background merges finish and check disk space before retrying.

This message carries severity level 16 in the database engine. It warns your team that a merge request for a transaction range did not run. The checkpoint files for that range could not merge at that moment. Your data remains safe, and the engine keeps running normal queries.

What causes sql server error 41365 in the database engine

In-memory tables store durable data on disk using pairs of checkpoint files. Over time, transactions create many files that hold inserted and deleted rows. The engine merges older files in the background to free up storage space. Admins can also request a manual merge for a specific transaction range.

The engine raises sql server error 41365 when it cannot schedule that merge request. The official message states that the merge request for the transaction range was not scheduled. This failure happens when the target checkpoint files do not qualify for merging yet. A background task might already be merging those same files right now. Sometimes, active transactions still need the rows inside that transaction range.

Storage limits can also stop a merge from starting on the host server. Merging files requires free disk space to write the new combined file first. If the volume holding your memory-optimized filegroup runs low on space, the merge stops. High write loads can also keep the checkpoint worker threads busy with new transactions.

How to diagnose and fix the failure in production

Start by checking the server error log to find the exact database name. Look for other storage or memory warnings near the timestamp of the failure. Check the free space on the disk drive that holds your checkpoint files. If disk space is low, add storage capacity so background merges can write new files.

Next, check if an automatic background merge is already running on the database. Wait a few minutes for active transactions and background tasks to finish their work. Run a manual database checkpoint before you try the merge request again. A fresh checkpoint closes open file ranges and prepares older files for merging.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Keep permissions tight when your team investigates this error in a live database. Do not grant full owner rights just to inspect checkpoint state and error logs. In SQL Server, the fixed owner role can perform all maintenance and drop the database. Instead, give responders a scoped login or a contained database user for one database. You cannot change the permissions assigned to fixed database roles on the server. Assign read-only roles for table checks and grant only the exact view state permissions needed. You can also mask sensitive fields like emails or phone numbers by rewriting query results.

How to prevent checkpoint merge failures

Avoid running manual merge scripts on a tight schedule in production databases. The built-in background merge policy handles file cleanup well under normal workloads. Manual requests often clash with automatic tasks and trigger this exact warning message.

Monitor the disk growth of your memory-optimized filegroup every day. Keep enough free space on the disk to hold several large checkpoint files at once. Spread heavy batch writes across off-peak hours so background merges can catch up.

Check SQL Server batches and results on the wire

SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does sql server error 41365 cause data loss or corruption?

No, this error does not mean your data is lost or corrupt. It only means the engine skipped a file merge request at that moment.

Why does severity 16 appear on this checkpoint merge message?

Severity 16 marks general errors that users or admins can fix. It tells you that the requested action did not run as planned.

Should my team retry a failed checkpoint merge right away?

Wait a few minutes and check free disk space before you retry. Most often, the automatic background process merges the files without manual help.

The query runs. The emails stay hidden.