Error 8624, Severity 16: Internal Query Processor Error: The query processor could not produce a query plan.

Mohanraj Selvarasu 20 Reputation points
2026-07-05T10:07:13.09+00:00

Hi,

Environrment : SQL Server 2022, build 16.0.4252.3 (CU24 + GDR, May 2026)

We are experiencing an intermittent issue on Microsoft SQL Server 2022 Enterprise Edition running in an Always On Availability Group environment.A specific stored procedure SP_XXXX_NAME executes successfully most of the time (approximately every 15–30 minutes). However, intermittently, the execution results in an internal Query Processor error, and SQL Server generates a dump file.

In most cases, SQL Server continues running after the dump is generated, and the Availability Group remains online. However, on a few occasions, the Availability Group transitions to the secondary replica without the SQL Server service restarting.

The SQL Error Log records the following:

ex_dump_if_requested: Exception raised, major=86, minor=24, state=246, severity=16

followed by:

Internal Query Processor Error:
The query processor could not produce a query plan.
For more information, contact Customer Support Services.

Windows Error Reporting captures:

Fault bucket: INVALID_REQUEST
Event Name: SQLException64

Problem signature:
P1: sqlservr.exe
P2: 0.0.0.0
P3: 0000000000000000
P4: sqllang.dll
P5: 16.0.4252.3
P6: 0000000069EE2EEE
P7: 17068
P8: 00000000003D9476
P9: 00000000C1FA39D3

A SQL dump is generated every time this issue occurs (SQLDumpxxxx.mdmp, SQLDumpxxxx.txt, and SQLDumpxxxx.log).

AG behavior

We have observed the following behavior:

  • Every occurrence generates a SQL dump.
  • Most dump events do not trigger an Availability Group failover.
  • Occasionally, the Availability Group transitions to the secondary replica.
  • The SQL Server service does not restart during these events (the SQL Server start time remains unchanged).

During the failover scenario, the SQL Error Log contains messages similar to:

Always On: The local replica of availability group '<AG_Name>' is preparing to transition to the resolving role.

The availability group '<AG_Name>' is being asked to stop the lease renewal because the availability group is going offline.

Remote harden of transaction failed.

However, we do not observe explicit lease timeout or HealthCheckTimeout messages in the SQL Server Error Log or Windows Failover Cluster Event Viewer. The cluster logs mainly contain Event IDs 1069 and 1025 during the failover.

Pls suggest whether this is a known issue or defect in SQL Server 2022 (build 16.0.4252.3), particularly within sqllang.dll or the Query Optimizer/Query Processor.

Explain why the same exception sometimes only generates a dump, while in other cases it causes the Availability Group to transition to the secondary replica even though the SQL Server service remains running.

Advise whether there are any available hotfixes, cumulative updates, or recommended workarounds.

Confirm whether this behavior is related to the database compatibility level (currently 120) or a known optimizer issue.

We appreciate your assistance and look forward to your analysis and recommendations.

SQL Server Database Engine
0 comments No comments

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 135.6K Reputation points MVP Volunteer Moderator
    2026-07-05T11:01:18.5233333+00:00

    I would guess the reason that you sometimes get a failover and sometimes not is due to some timing issue. Sometimes, the error triggers the monitoring, and sometimes not. Maybe because if the errors occur close enough to each other, the cluster thinks the replica is not healthy and decides to fail over. To address this, you could change the FAILURE_CONDITION_LEVEL for the AG. The default level is 3, for which the documentation says (emphasis mine):

    Specifies that an automatic failover should be initiated on critical SQL Server internal errors, such as orphaned spinlocks, serious write-access violations, or too much dumping.

    However, I would not recommend taking this step. Rather, you need to work with the root cause, which is the failing query. It is interesting that the procedure sometimes succeeds, and sometimes fails with this error. Normally, when you get this error, you get it constantly. However, if the problematic query has OPTION (RECOMPILE) or the procedure is constructing dynamic SQL, there is compilation every time and depending on the values, a plan may or may not be possible to construct. It is not uncommon that this due to that hints that have been added to the query.

    So what you need to do is to track down exactly what query/queries that are failing. Once you know the query, you can try to get an understanding of why the compilation fails and from this make the required changes.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.