HKUDS/nanobot · error · OSError

Could not resolve

Error message

Could not resolve {host}

What it means

In _probe_tcp(), every resolved IP failed to connect (all attempts raised OSError) yet no error was captured — i.e. resolved_ips was empty even though resolve_url_target reported ok. This is the defensive sentinel for 'the host produced no usable addresses'; the input at fault is the hostname that could not actually be resolved or yielded no connectable IPs.

Solutions

  1. Check DNS for the configured host (typo, expired record, missing resolver)
  2. Use an IP literal or a correctly qualified hostname
  3. Verify the host is reachable from the machine running the validator
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at nanobot/channels/validation.py:382 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/f740488c011abdb5. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/channels/validation.py:382

        allow_loopback=allow_loopback,
    )
    if not ok:
        raise ValueError(error)

    context = ssl.create_default_context()
    last_error: OSError | None = None
    for target_ip in resolved_ips:
        try:
            with socket.create_connection((target_ip, port), timeout=_TIMEOUT_SECONDS) as sock:
                if port in {465, 993, 995}:
                    with context.wrap_socket(sock, server_hostname=host.strip("[]")):
                        return
                return
        except OSError as exc:
            last_error = exc
    if last_error is not None:
        raise last_error
    raise OSError(f"Could not resolve {host}")


# Public helpers for channel-owned validators. Keeping response shaping here lets
# each package own its platform checks without depending on WebUI implementation
# modules.
check = _check
enabled = _enabled
http_get = _http_get
http_post = _http_post
int_value = _int
message_from_response = _message_from_response
official_action = _official_action
payload = _payload
probe_tcp = _probe_tcp
required_checks = _required_checks
status_from_checks = _status_from_checks
string_value = _str
truthy = _truthy

View on GitHub (pinned to 42f37dc4c0)