Comfy-Org/ComfyUI · error · LocalNetworkError

Unable to connect to the network. Please check your internet

Error message

Unable to connect to the network. Please check your internet connection and try again.

What it means

LocalNetworkError raised when the PUT fails with aiohttp.ClientError or OSError, retries are exhausted, and _diagnose_connectivity() reports the machine cannot reach the internet. It distinguishes 'your machine is offline' from 'the API service is down' so users get an actionable message. It chains from the original transport exception.

Source

Thrown at comfy_api_nodes/util/upload_helpers.py:373

                    request_url=upload_url,
                    request_headers=headers or None,
                    request_data=f"[File data {len(data)} bytes]",
                    error_message=f"{type(e).__name__}: {str(e)} (will retry)",
                )
                await sleep_with_interrupt(
                    delay,
                    cls,
                    wait_label,
                    start_ts,
                    None,
                    display_callback=_display_time_progress if wait_label else None,
                )
                delay *= retry_backoff
                continue

            diag = await _diagnose_connectivity()
            if not diag["internet_accessible"]:
                raise LocalNetworkError(
                    "Unable to connect to the network. Please check your internet connection and try again."
                ) from e
            raise ApiServerError("The API service appears unreachable at this time.") from e
        finally:
            stop_evt.set()
            if monitor_task:
                monitor_task.cancel()
                with contextlib.suppress(Exception):
                    await monitor_task
            if sess:
                with contextlib.suppress(Exception):
                    await sess.close()


def _generate_operation_id(method: str, url: str, attempt: int, op_uuid: str) -> str:
    try:
        parsed = urlparse(url)
        slug = (parsed.path.rsplit("/", 1)[-1] or parsed.netloc or "upload").strip("/").replace("/", "_")

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Verify internet connectivity (curl https://example.com) and reconnect the network, then re-run the workflow.
  2. Check DNS (nslookup the API host) and proxy settings — set HTTPS_PROXY if your network requires it.
  3. Temporarily disable VPN/firewall rules that may block the ComfyUI process's outbound traffic.
  4. If on a locked-down network, allowlist the ComfyUI API upload endpoints.
Defensive patterns

Strategy: fallback

Validate before calling

import socket, urllib.request

def internet_ok(host: str = "https://example.com", timeout: float = 3.0) -> bool:
    try:
        urllib.request.urlopen(host, timeout=timeout)
        return True
    except OSError:
        return False

Try / catch

from comfy_api_nodes.util.common_exceptions import LocalNetworkError
try:
    await upload_image_to_comfyapi(cls, image)
except LocalNetworkError:
    show_user("No internet connection — check network and retry")

Prevention

When it happens

Trigger: except (aiohttp.ClientError, OSError) fires after max_retries (e.g., aiohttp.ClientConnectorError DNS failure, connection refused), then _diagnose_connectivity() returns internet_accessible=False and LocalNetworkError is raised at upload_helpers.py:373.

Common situations: Machine lost Wi-Fi/Ethernet mid-workflow; DNS resolution broken; firewall or proxy blocking outbound HTTPS; corporate network requiring a proxy that aiohttp is not configured to use; VPN dropped.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/77ce4098e397c718. Report an issue: GitHub.