Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

SQL Server Error 1093: Is Not a Valid Broker Name

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

SQL Server error 1093 means the Service Broker endpoint or application tried to reference a broker name that does not exist in the current database or instance. In plain terms, the name you typed in a BEGIN DIALOG, CREATE ROUTE, CREATE SERVICE, or endpoint command is not registered as a valid broker identifier. The fix is to confirm the exact broker name, check that Service Broker is enabled, and correct the name in your script or configuration.

What You'll Need

  • Access to SQL Server Management Studio (SSMS) or another client that can run T-SQL.
  • Membership in a role that can view and alter Service Broker objects, such as db_owner in the affected database or sysadmin for instance-level checks.
  • The exact name of the broker, service, or route that the failing script or application is trying to use.
  • The name of the database where Service Broker is configured.

Step-by-Step

  1. Identify where the error occurs. Note whether it appears when you run a T-SQL script, when an application starts a dialog, or when SQL Server Agent runs a job. The error message usually includes the invalid broker name, which is the key clue.
  2. Check that Service Broker is enabled on the database. Run SELECT name, is_broker_enabled FROM sys.databases WHERE name = 'YourDatabase';. If is_broker_enabled is 0, enable it with ALTER DATABASE YourDatabase SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;. Be aware that this can roll back open transactions, so run it during a maintenance window.
  3. List the services and routes in the database. Run SELECT name, service_broker_guid FROM sys.services; and SELECT name, broker_instance FROM sys.routes;. Compare the names returned with the name in your failing command. The error 1093 almost always means the name in the command is not in these lists.
  4. Verify the broker instance name. The broker name is not the same as the SQL Server instance name. Check it with SELECT service_broker_guid FROM sys.databases WHERE name = 'YourDatabase'; and compare with the broker_instance values in sys.routes. If you are creating a route, the BROKER_INSTANCE value must match the remote database's broker GUID, not a friendly name.
  5. Correct the name in your script. If the command uses a literal name, replace it with the exact value from sys.services or sys.routes. Names are case-sensitive in some collations, so match the case exactly. If the name was generated by an application, update the application's configuration to use the correct broker name.
  6. Re-run the failing command. If the name now matches an existing service or route, error 1093 should disappear. If it persists, move to the troubleshooting section below.
  7. Check for a missing route or service on the remote side. If the error occurs during a dialog with another database or instance, the remote broker name must be registered as a route on the local instance. Create it with CREATE ROUTE RouteName WITH SERVICE_NAME = 'target_service', ADDRESS = 'TCP://remotehost:4022'; and ensure the remote service exists.
  8. Restart the SQL Server service if you changed instance-level broker settings. Some endpoint or broker configuration changes require a service restart to take effect. Plan this for a maintenance window and warn users.

Common Mistakes

  • Confusing the broker name with the SQL Server instance name. The broker name is a GUID stored in the database, not the server hostname. Using the hostname in a BROKER_INSTANCE clause causes error 1093.
  • Using a service name where a broker name is required. BEGIN DIALOG uses a service name, while routes use a broker instance GUID. Mixing them up produces this error.
  • Forgetting that Service Broker must be enabled. If is_broker_enabled is 0, no broker names are valid and any broker command can fail.
  • Case and collation mismatches. In a case-sensitive collation, MyService and myservice are different names. Copy the name directly from the system view to avoid typos.
  • Assuming a route exists on both sides. A dialog needs a route on the initiating instance pointing to the target, and often a return route. Missing routes can surface as broker name errors.

Tips

  • Always query sys.services, sys.routes, and sys.databases before editing Service Broker scripts. Copying names from these views prevents most 1093 errors.
  • Use WITH ROLLBACK IMMEDIATE only when you understand the impact; it terminates other connections and rolls back open transactions.
  • Keep a record of the broker GUID for each database. When you restore or copy a database, the GUID changes, and old routes may become invalid.
  • Test Service Broker changes in a non-production copy first. Broker configuration is easy to get subtly wrong.
  • Use the sys.transmission_queue and sys.conversation_endpoints views to see whether messages are stuck because of a bad route or broker name.

Troubleshooting

If the error persists after correcting the name, work through these checks in order. First, confirm the database context: run USE YourDatabase; before your broker commands, because broker names are scoped to a database. Second, check that the Service Broker endpoint is started with SELECT name, state_desc FROM sys.endpoints WHERE type_desc = 'SERVICE_BROKER';. If the state is STOPPED, start it with ALTER ENDPOINT BrokerEndpoint STATE = STARTED;. Third, verify that the remote service and broker instance are reachable by checking the route address and port. Fourth, look for typographical errors in the broker name, including trailing spaces. Fifth, if you recently restored a database, the broker GUID changed; recreate routes that reference the old GUID. Sixth, if the error comes from an application, check its connection string and configuration for a hard-coded broker name that no longer exists. Finally, if you changed instance-level settings, restart the SQL Server service and retest.

Frequently Asked Questions

What causes SQL Server error 1093?

The error occurs when a Service Broker command references a broker name that is not registered in the current database or instance. Common causes are typos, a disabled broker, or a restored database whose broker GUID changed.

Is the broker name the same as the SQL Server instance name?

No. The broker name is a GUID stored in the database, while the instance name identifies the SQL Server installation. Using the instance name where a broker GUID is expected causes error 1093.

How do I find the correct broker name?

Query SELECT service_broker_guid FROM sys.databases WHERE name = 'YourDatabase'; for the database broker GUID, and SELECT name, broker_instance FROM sys.routes; for route broker instances. Use those exact values in your commands.

Can error 1093 appear after restoring a database?

Yes. A restore generates a new broker GUID, so routes and dialogs that reference the old GUID become invalid. Recreate the routes with the new broker instance value.

Does enabling Service Broker require a restart?

Enabling Service Broker on a database does not require a restart, but some endpoint or instance-level changes may. Plan a maintenance window if you are unsure.

What should I check first if the error keeps happening?

Confirm the database context, verify that Service Broker is enabled, and compare the name in your command with the values in sys.services and sys.routes. Those three checks resolve most cases.