Troubleshooting Guide: SQL Server Error 5839 – Service Broker Message Forward Store Size Cannot Be Set to 0
Why This Error Happens
Error 5839 occurs when Service Broker attempts to configure the message forwarding store with a size value of 0, which SQL Server 2025 treats as an invalid configuration because the forwarding store requires a minimum allocation to buffer in-transit messages. This typically happens due to a misconfigured sp_configure setting, a corrupted msdb or Service Broker system catalog, or an automated deployment script that incorrectly passes a zero value during instance provisioning. It can also surface after an in-place upgrade from an older SQL Server version where legacy Service Broker settings were not properly migrated.
Step-by-Step Resolution Guide
Step 1: Verify Current Service Broker Configuration
- Open SQL Server Management Studio (SSMS) and connect to the affected instance.
- Run
SELECT * FROM sys.databases WHERE is_broker_enabled = 1;to confirm Service Broker status. - Check the forwarding store setting using
EXEC sp_configure 'Service Broker forward message size';.
Step 2: Correct the Forward Message Store Size Value
- Run the following T-SQL to reset the value to a supported minimum (never 0):
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;EXEC sp_configure 'Service Broker forward message size', 4096; RECONFIGURE;- Restart the SQL Server service via
services.mscor runNET STOP MSSQLSERVER && NET START MSSQLSERVERin an elevated Command Prompt on Windows Server 2025.
Step 3: Inspect and Repair Deployment or Configuration Scripts
- Locate any PowerShell or DSC (Desired State Configuration) scripts under
C:\SQLConfig\or your CI/CD pipeline repository that provision the instance. - Search for parameters like
-BrokerForwardSize 0or similar JSON/XML config keys and update them to a non-zero value (e.g., 4096 or higher). - Redeploy the configuration using
Invoke-SqlCmdor your orchestration tool to ensure the corrected value persists.
Step 4: Rebuild the Service Broker GUID (If Corruption Is Suspected)
- Run
ALTER DATABASE [YourDatabase] SET NEW_BROKER;to reset a corrupted broker identifier. - Follow with
ALTER DATABASE [YourDatabase] SET ENABLE_BROKER;to reactivate messaging. - Confirm no orphaned conversation endpoints remain using
SELECT * FROM sys.conversation_endpoints;.
Alternative or Verification Steps
- After applying changes, run
SELECT * FROM sys.configurations WHERE name = 'Service Broker forward message size';and confirm thevalue_in_usecolumn shows a non-zero number. - If the error persists, restore the
msdbdatabase from a known-good backup taken prior to the misconfiguration, then reapply Step 2 before bringing the instance back online.