reflex-dev/reflex · error · Exception

deployment failed: {ex_details}

Error message

deployment failed: {ex_details}

What it means

Raised by get_hostname when the reserve request fails with a JSON `detail` message other than the special 'hostname taken' case. The server's detail string is embedded so the specific failure (auth, quota, project config, etc.) is visible.

Source

Thrown at packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py:1512

        urljoin(constants.Hosting.HOSTING_SERVICE, "/api/v1/apps/reserve"),
        headers=authorization_header(client.token),
        json=data,
        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.

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Read the embedded `detail` message — it identifies the exact server-side reason
  2. Fix the reported issue (app config, limits, project selection) and retry the deploy
  3. If the detail is unclear, run `reflex deploy` with verbose/debug logging enabled and check the hosting dashboard for app state
Defensive patterns

Strategy: try-catch

Try / catch

try:
    result = get_hostname(client, app_id, app_name, hostname=hostname)
except Exception as e:
    detail = str(e).removeprefix("deployment failed: ")
    # branch on the server-provided detail message
    handle(detail)

Prevention

When it happens

Trigger: Any non-2xx reserve response with a JSON body containing `detail` — e.g. invalid app configuration, project limits reached, or server-side validation failures during `reflex deploy`.

Common situations: Deploying an app in a bad state; exceeding plan limits; server-side policy changes returning structured errors.

Related errors


AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28). Data as JSON: /api/errors/b8a7cc8d741e8c13. Report an issue: GitHub.