When you see this status
- Client requests a resource with complex content negotiation
- Server detects circular dependencies in negotiated variants
- Proxy misconfigures variant negotiation headers
Common causes
- Circular $ref in OpenAPI/Swagger specs
- Improper Vary header configuration
- Misconfigured content negotiation middleware
- Server-side variant resolution loops
How to debug it
- Inspect request headers for Accept, Accept-Charset, Accept-Encoding
- Check server logs for variant resolution attempts
- Validate OpenAPI/Swagger definitions for circular references
- Review proxy or CDN variant handling configuration
Return this code in your framework
Express (Node.js)
res.status(506).send('Variant Also Negotiates');
FastAPI (Python)
from fastapi import status
return JSONResponse(status_code=status.HTTP_506_VARIANT_ALSO_NEGOTIATES, content={"error": "Variant negotiation failed"})
NestJS
@Get() getVariant() { throw new HttpException('Variant negotiation failed', HttpStatus.VARIANT_ALSO_NEGOTIATES); }
Go (net/http)
http.Error(w, "Variant Also Negotiates", http.StatusVariantAlsoNegotiates)
About HTTP 506
HTTP status code 506 Variant Also Negotiates is part of the
5xx Server Error family. Server cannot properly negotiate the requested variant due to circular references in content negotiation. Understanding it is essential for
backend engineers, API designers, and anyone debugging integrations between services.
The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance:
what triggers them, how to debug them in production, and exactly how to return them from common
frameworks. Each code page is hand-curated and verified.