reflex-dev/reflex · error · ArchiveUploadError

the upload did not finish before its window closed; this usu

Error message

the upload did not finish before its window closed; this usually means the connection is too slow for the size of the build

What it means

Raised after all UPLOAD_ATTEMPTS iterations fail: every storage PUT returned 403 FORBIDDEN, meaning the presigned upload window expired before the transfer completed each time. The message explains this usually indicates the connection is too slow for the build size.

Source

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

            raise ArchiveUploadError(
                f"could not reach the deployment service: {ex}"
            ) from ex
        if reservation is None:
            return None
        try:
            _put_reserved_archives(zip_dir, reservation, sizes)
        except httpx.HTTPStatusError as ex:
            if ex.response.status_code != HTTPStatus.FORBIDDEN:
                raise ArchiveUploadError(
                    f"could not upload the build to storage: HTTP {ex.response.status_code}"
                ) from ex
            if attempt < UPLOAD_ATTEMPTS - 1:
                logger.warning("the upload window expired; reserving another one")
        except httpx.HTTPError as ex:
            raise ArchiveUploadError(f"could not upload the build: {ex}") from ex
        else:
            return reservation["deployment_id"]
    raise ArchiveUploadError(
        "the upload did not finish before its window closed; this usually means "
        "the connection is too slow for the size of the build"
    )


def create_deployment(
    zip_dir: Path,
    client: AuthenticatedClient,
    app_name: str | None,
    project_id: str | None,
    regions: list | None,
    hostname: str | None,
    vmtype: str | None,
    secrets: dict | None,
    packages: list | None,
    strategy: str | None,
    app_id: str | None,
    description: str | None = None,

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Reduce the deployment bundle size (remove large files from .web/static, compress assets)
  2. Upgrade connection speed or switch networks, then redeploy
  3. Update reflex-hosting-cli — newer versions may chunk uploads or extend windows
  4. If the build genuinely must be large, contact Reflex hosting support for raised limits
Defensive patterns

Strategy: fallback

Validate before calling

import os
build_mb = get_dir_size('.web') / 1e6
if build_mb > 100:
    warn('large bundle; upload window may expire on slow links')

Try / catch

try:
    upload_archives(...)
except ArchiveUploadError as ex:
    if 'upload did not finish before its window closed' in str(ex):
        strip_large_assets(); retry()

Prevention

When it happens

Trigger: Each attempt to PUT the archives gets a 403 because the presigned URL's time window lapsed mid-upload; happens repeatedly with large builds on slow connections.

Common situations: Uploading hundreds of MB on slow uplinks; proxies adding latency; huge static assets bundled into .web.

Related errors


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