Comfy-Org/ComfyUI · error · UploadError

MISSING_FILE

MISSING_FILE

Error message

Form must include a 'file' part or a known 'hash'.

What it means

Raised as LocalNetworkError (comfy_api_nodes/util/client.py:930) from the connection-failure handler when an aiohttp ClientConnectorError/OSError occurs AND the built-in connectivity diagnosis (_diagnose_connectivity probing google.com and baidu.com, 5s timeout) finds no internet access. The client distinguishes 'your machine is offline' from 'the API is down' — this error is the local-side verdict.

Source

Thrown at app/assets/api/upload.py:144

        elif fname == "tags":
            tags_raw.append((await field.text()) or "")
        elif fname == "name":
            provided_name = (await field.text()) or None
        elif fname == "user_metadata":
            user_metadata_raw = (await field.text()) or None
        elif fname == "id":
            raise UploadError(
                400,
                "UNSUPPORTED_FIELD",
                "Client-provided 'id' is not supported. Asset IDs are assigned by the server.",
            )
        elif fname == "mime_type":
            provided_mime_type = ((await field.text()) or "").strip() or None
        elif fname == "preview_id":
            provided_preview_id = ((await field.text()) or "").strip() or None
    if not file_present and not (provided_hash and provided_hash_exists):
        raise UploadError(
            400, "MISSING_FILE", "Form must include a 'file' part or a known 'hash'."
        )

    if (
        file_present
        and file_written == 0
        and not (provided_hash and provided_hash_exists)
    ):
        delete_temp_file_if_exists(tmp_path)
        raise UploadError(400, "EMPTY_UPLOAD", "Uploaded file is empty.")

    return ParsedUpload(
        file_present=file_present,
        file_written=file_written,
        file_client_name=file_client_name,
        tmp_path=tmp_path,
        tags_raw=tags_raw,
        provided_name=provided_name,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Verify general internet access from the same machine (browser or curl to any site)
  2. Fix local networking: reconnect wifi, check DNS, restart router/VPN
  3. If a firewall whitelists specific hosts, allow the probe domains or accept that diagnosis reads 'local' and allow the API host explicitly
  4. Retry once the network is stable — the probes are best-effort over 5s, flaky links can false-positive
Defensive patterns

Strategy: validation

Validate before calling

import socket, urllib.request
async def preflight_network() -> bool:
    try:
        urllib.request.urlopen("https://www.baidu.com", timeout=5)
        return True
    except OSError:
        return False
assert await preflight_network(), "No internet — fix local network before running API nodes"

Type guard

from comfy_api_nodes.util.common_exceptions import LocalNetworkError

def is_local_network_error(e: BaseException) -> bool:
    return isinstance(e, LocalNetworkError)

Try / catch

from comfy_api_nodes.util.common_exceptions import LocalNetworkError
try:
    result = await sync_op(...)
except LocalNetworkError:
    notify_user("Check internet connection")
    return

Prevention

When it happens

Trigger: Machine fully offline (wifi/ethernet down); DNS resolution broken system-wide; firewall or security software blocking all outbound HTTPS; the 5-second probe window expiring on very slow/unstable links so both probes fail.

Common situations: Laptops resuming from sleep before network reassociates; containerized environments without network egress; corporate firewalls whitelisting only specific hosts (google/baidu probes blocked even though the API host might be reachable); DNS misconfiguration.

Related errors


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