How to Fix SQL Server Error 15401 (Msg 15401)

Published
Length
4 min read

Luis Felipe Dias

All posts

You get sql server error 15401 when the database engine cannot find a Windows user or group. You can fix it by checking the exact domain name, host name, and account spelling. This failure returns message 15401 at severity level 11 in Microsoft SQL Server. The engine reports that the Windows NT user or group is not found. It asks you to check the name again before you retry the task. This happens when an admin tries to add or change a Windows login. What causes sql server error 15401 in the d

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 get sql server error 15401 when the database engine cannot find a Windows user or group. You can fix it by checking the exact domain name, host name, and account spelling.

This failure returns message 15401 at severity level 11 in Microsoft SQL Server. The engine reports that the Windows NT user or group is not found. It asks you to check the name again before you retry the task. This happens when an admin tries to add or change a Windows login.

What causes sql server error 15401 in the database engine

SQL Server relies on the host operating system or domain controller to check Windows accounts. When you create a login from a Windows user, the engine queries the local machine or domain. If that lookup fails, the engine stops the action and throws message 15401.

A common cause is a simple typo in the domain name or user name. Case sensitivity does not usually break Windows lookups, but wrong prefixes will. You must put the domain name or local machine name before the backslash and user name. If you use the wrong machine name for a local account, the lookup fails right away.

Network path failures between the database host and the domain controller also trigger this error. If the server cannot reach the domain directory, it cannot check the group or user name. Trust issues between two different domains can block the lookup in the same way. Sometimes the account does not exist yet because the identity team has not finished making it.

How to diagnose and fix the failure safely in production

Start your check by confirming the exact account name in your directory or local host list. Check whether the account is a local user on the server or a domain account. For a local user, use the actual host name of the database server as the prefix. For a domain user or group, use the exact domain name before the backslash.

Next, check that the database server can talk to your domain controller over the network. If the server lost its trust link with the domain, fix that host issue first. Do not create broad admin accounts to work around a broken domain lookup.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can also review how you set up accounts for your database team. A database user is the identity of a login when it connects to a database. Microsoft SQL Server supports 13 types of database users for different access needs. When a person needs access to many databases on an instance, a login in master is common.

When a person only needs access to one or a few databases, you have another option. You can use a contained database user, which is a SQL user with a password. This user type is not tied to a login in the master database. An admin must first enable contained databases on the server and on the target database.

Setting safe permissions after the user login works

Once you fix the account lookup and add the database user, grant only the needed role. Never add regular users or apps to the owner role just to avoid permission errors. Members of the owner role can do all setup and maintenance tasks. They can even drop the whole database in SQL Server.

Instead, use fixed roles that match the exact job the person needs to do. Every role, including the public role, already has permission to connect. You cannot change the permissions that belong to fixed database roles. If a team member only needs to read data, use the data reader role. Members of that role can read all data from all user tables and views.

If an app must change records, use the data writer role instead of full owner rights. Members of the data writer role can add, delete, or change data in all user tables. You can also block access with deny roles for reading or writing data. When you pair clean identity checks with data masking that rewrites emails and phone numbers, production stays safe.

Add runtime guardrails beside SQL Server

Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.

Frequently asked questions

What does severity 11 mean for message 15401?

Severity 11 means the given object or entity does not exist from the engine view. In this case, the engine cannot find the Windows user or group name you typed.

Can I use a SQL user instead of a Windows user for one database?

Yes, you can use a contained database user with a password for one or a few databases. An admin must first turn on contained databases on the server and on that database.

Which role should I give a user who only runs select queries?

Add the user to the fixed data reader role after you create the database user. That role lets the member read all user tables and views without changing any data.

The query runs. The emails stay hidden.