SignalR: Error: Failed to complete negotiation with the server / Failed to start the connection
The SignalR client couldn’t negotiate with the hub — wrong URL, CORS, authentication, or a proxy that blocks WebSockets/negotiate requests.
Seen on:
.NET
Meaning
Negotiate is a POST to /hub/negotiate. 404 means wrong path/MapHub, CORS errors require AllowCredentials with specific origins, 401 means the token wasn’t sent (use accessTokenFactory). Load balancers need sticky sessions unless using SkipNegotiation with WebSockets.
Common causes
- Hub URL or MapHub path mismatch
- CORS not allowing the client origin with credentials
- Missing auth token (accessTokenFactory)
- Proxy/load balancer without WebSocket support or sticky sessions
⚡ Quick fix
- Check the network tab for the negotiate response code
- Configure CORS with WithOrigins + AllowCredentials
- Pass tokens via accessTokenFactory; enable sticky sessions or Azure SignalR
Detailed fix by platform
JavaScript
- javascript
const conn = new signalR.HubConnectionBuilder() .withUrl("https://api.example.com/hubs/chat", { accessTokenFactory: () => token }) .withAutomaticReconnect() .build();
How to diagnose
- Negotiate — Status code
- CORS — Console errors
- Proxy — WebSockets allowed?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- An unhandled error has occurred Blazor: An unhandled error has occurred. Reload 🗙
- antiforgery token could not be decrypted ASP.NET Core: The antiforgery token could not be decrypted / The required antiforgery cookie is not present (400 Bad Request)
- Cannot access a disposed context instance ObjectDisposedException: Cannot access a disposed context instance
Most viewed in .NET
- NullReferenceException System.NullReferenceException: Object reference not set to an instance of an object
- FileNotFoundException assembly Could not load file or assembly 'X, Version=…' or one of its dependencies
- InvalidOperationException InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y'
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026