How to Fix SQL Server Error 10537 (Msg 10537)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see sql server error 10537 when you try to turn on a conflicting plan guide. To fix it, you must disable or drop the existing active plan guide first. This failure returns message 10537 at severity level 16 in the database engine. The engine stops your request because another active plan guide shares the exact same target. Both guides point to the same scope and starting offset value in your database. The query optimizer cannot apply two guides to the exact same statement at once. You must

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 10537 when you try to turn on a conflicting plan guide. To fix it, you must disable or drop the existing active plan guide first.

This failure returns message 10537 at severity level 16 in the database engine. The engine stops your request because another active plan guide shares the exact same target. Both guides point to the same scope and starting offset value in your database. The query optimizer cannot apply two guides to the exact same statement at once. You must pick one plan guide to keep active for that specific query location.

Root causes of sql server error 10537 in the database engine

Plan guides let admins tune query plans without changing the underlying query text directly. Each plan guide links to a specific query statement inside a defined database scope. The engine tracks where that statement begins using a specific starting offset value. When you enable a dormant plan guide, the engine checks all active guides first. If an enabled guide already uses that scope and offset, the action fails right away.

Message 10537 is a severity 16 error, which means a user can fix it. It does not point to a broken server, network glitch, or hardware disk crash. Instead, it happens when database teams deploy duplicate tuning rules over time. One engineer might create and disable a test guide during a busy incident. Later, another engineer creates a second guide for the same slow stored procedure or batch. When someone tries to re-enable the old guide, the engine blocks the change.

Deployment scripts can also trigger this issue during automated releases. If a release script tries to enable all guides without checking current states, it fails. Two guides with different names can still target the exact same statement offset. The database engine cares about the scope and offset, not just the guide name.

How to diagnose and fix the failure in production

First, read the error output carefully to find both plan guide names. The message lists the guide you tried to enable and the guide blocking it. Next, inspect the catalog views in your database to compare both plan guides. Check the query text, scope details, and hints attached to each conflicting guide. Decide which guide gives your query the best execution plan for current workloads.

Once you choose the right guide, disable or drop the unwanted active guide. After you turn off the conflicting guide, you can enable the target guide safely. Always test the active query plan afterward to confirm that query speed stays fast. Remove old, disabled guides that you no longer need so nobody turns them on later.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

When you fix this in production, keep database permissions tight and safe. Avoid giving broad owner rights to engineers who only inspect plan guide metadata. The fixed owner role can run all maintenance tasks and even drop the database. Note that you cannot change the permissions assigned to fixed database roles. For people who access many databases, a standard user tied to a login works well. For one or a few databases, admins can set up a contained database user instead. Grant only the exact rights needed to view metadata or manage plan guides safely.

Preventing plan guide conflicts across database teams

Most plan guide conflicts happen because teams lack a clear change log for tuning rules. When multiple engineers tune queries on their own, duplicate guides pile up fast. Keep a single source of truth for all custom tuning objects in version control. Before adding a new guide, check if a disabled guide already exists for that scope.

Set up a peer review step for any script that changes query plans in production. Reviewers should check that scripts clean up old guides before adding new ones. Good peer reviews stop message 10537 before the deployment ever reaches your live database. Clear audit trails also show who enabled or disabled a plan guide during an incident.

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

What does severity 16 mean for message 10537?

Severity 16 means the error comes from a user mistake, like conflicting rules. The database stays online, and an engineer can fix it by updating the guides.

Can two disabled plan guides share the same scope and offset?

Yes, the database allows multiple disabled guides for the same scope and starting offset. The error only triggers when you try to have two enabled at the same time.

Should I give engineers the db_owner role to fix plan guides?

No, members of that role can run all maintenance tasks and drop the database. Grant smaller, specific permissions so engineers can check and fix guides without full database control.

The query runs. The emails stay hidden.