reflex-dev/reflex · error · Exception
deployment failed: HTTP {ex.response.status_code} - {ex.resp
Error message
deployment failed: HTTP {ex.response.status_code} - {ex.response.text} What it means
Raised by get_hostname when a failed reserve response has no parseable JSON detail — the raw HTTP status code and body text are wrapped into the exception instead. This is the fallback error shape for unexpected server responses.
Source
Thrown at packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py:1515
timeout=constants.Hosting.TIMEOUT,
)
try:
response.raise_for_status()
except httpx.HTTPStatusError as ex:
if ex.response.status_code == 413:
raise Exception(
"deployment failed: the deployment payload is too large (over 100MB). "
"Please reduce the size of your project by removing large files or "
"adding them to your .gitignore file."
) from ex
try:
ex_details = ex.response.json().get("detail")
if ex_details == "hostname taken":
return {"error": "hostname taken"}
raise Exception(f"deployment failed: {ex_details}") from ex
except (ValueError, AttributeError):
# Response is not valid JSON or missing detail field
raise Exception(
f"deployment failed: HTTP {ex.response.status_code} - {ex.response.text}"
) from ex
response_json = response.json()
return response_json
def extract_subdomain(url: str):
"""Extract the subdomain from a given URL.
Args:
url: The URL to extract the subdomain from.
Returns:
str | None: The extracted subdomain, or None if extraction fails.
"""
from urllib.parse import urlparse
View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Retry the deploy after a short wait — transient 5xx/gateway errors usually resolve
- Check the Reflex hosting status page/dashboard for ongoing incidents
- If persistent, capture the status code and body from the message and report to Reflex support
Defensive patterns
Strategy: retry
Try / catch
for attempt in range(3):
try:
result = get_hostname(client, app_id, app_name)
break
except Exception as e:
if "HTTP 5" in str(e) and attempt < 2:
time.sleep(2 ** attempt)
continue
raise Prevention
- Retry deploys on transient gateway errors with backoff
- Check hosting status during incidents
- Treat non-JSON error bodies as transient unless repeated
When it happens
Trigger: The hosting service returns a non-2xx with an HTML/plain-text body (proxy error page, 502/503 from a gateway, or a malformed JSON body) during hostname reservation/deploy.
Common situations: Transient hosting-service outages; Cloudflare/proxy error pages masking the API; partial maintenance-window responses.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- bad hostname provided
- deployment failed: {ex_details}
- app_name should be a string
- ChildrenTypeError(component=cls.__name__, child=child)
- Do not override _add_style directly. Use add_style instead.
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/8ba881148090ea1c.
Report an issue: GitHub.