HelloZeroNet/ZeroNet · error · AnnounceError
Could not connect
Error message
Could not connect
What it means
AnnounceBitTorrentPlugin announces a site's peers via a UDP BitTorrent tracker. announceTrackerUdp calls tracker.connect() then poll_once(); if the first poll returns nothing (no UDP response / connect handshake failed), it raises AnnounceError("Could not connect"). This means the tracker never responded to the initial connection, so the announce cannot proceed.
Source
Thrown at plugins/AnnounceBitTorrent/AnnounceBitTorrentPlugin.py:61
handler = super(SiteAnnouncerPlugin, self).getTrackerHandler(protocol)
return handler
def announceTrackerUdp(self, tracker_address, mode="start", num_want=10):
s = time.time()
if config.disable_udp:
raise AnnounceError("Udp disabled by config")
if config.trackers_proxy != "disable":
raise AnnounceError("Udp trackers not available with proxies")
ip, port = tracker_address.split("/")[0].split(":")
tracker = UdpTrackerClient(ip, int(port))
if helper.getIpType(ip) in self.getOpenedServiceTypes():
tracker.peer_port = self.fileserver_port
else:
tracker.peer_port = 0
tracker.connect()
if not tracker.poll_once():
raise AnnounceError("Could not connect")
tracker.announce(info_hash=self.site.address_sha1, num_want=num_want, left=431102370)
back = tracker.poll_once()
if not back:
raise AnnounceError("No response after %.0fs" % (time.time() - s))
elif type(back) is dict and "response" in back:
peers = back["response"]["peers"]
else:
raise AnnounceError("Invalid response: %r" % back)
return peers
def httpRequest(self, url):
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding': 'none',
'Accept-Language': 'en-US,en;q=0.8',View on GitHub (pinned to 454c0b2e7e)
Solutions
- Verify the tracker address is alive (e.g. test with a bittorrent client or dig/nc for the UDP port).
- Check local firewall/NAT allows outbound UDP on the tracker port.
- Wait and retry — announce is retried periodically and other trackers (AnnounceTrackers plugin) cover failures.
- Replace the dead tracker in the site's tracker list.
- Check Tor/transparent proxy config is not blocking UDP.
Example fix
// before
tracker.connect()
if not tracker.poll_once():
raise AnnounceError("Could not connect")
// after
tracker.connect()
if not tracker.poll_once():
self.site.log.debug("UDP tracker %s unreachable, skipping" % tracker_address)
return [] # let other trackers handle announce Defensive patterns
Strategy: retry
Validate before calling
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(5)
try:
host, port = tracker_address.split(":")
sock.sendto(b"probe", (socket.gethostbyname(host), int(port)))
reachable = True
except (socket.error, socket.gaierror):
reachable = False
finally:
sock.close()
if not reachable:
skip_tracker(tracker_address) Try / catch
try:
peers = announce_plugin.announceTrackerUdp(tracker_address, file_info)
except AnnounceError as e:
log.warning("UDP tracker %s failed: %s" % (tracker_address, e))
peers = [] # other announce plugins will cover Prevention
- Validate tracker addresses resolve and respond to UDP before adding to site tracker list
- Run periodic tracker health checks and drop dead ones
- Keep multiple announce plugins enabled for redundancy
- Ensure firewall/NAT permits outbound UDP
When it happens
Trigger: The UDP tracker at the configured tracker address is unreachable or drops packets: tracker domain resolves wrong, UDP traffic blocked by firewall/NAT, tracker offline, or wrong port in the site's tracker list. tracker.poll_once() times out after tracker.connect().
Common situations: Firewalled/censored networks blocking UDP; dead public BitTorrent trackers; trackers configured in site's sites.json that no longer exist; IPv6 vs IPv4 mismatch (getIpType check sets peer_port=0 but tracker still unresponsive).
Related errors
- No response after %.0fs
- Invalid response: %r
- Udp disabled by config
- Udp trackers not available with proxies
- Invalid response: %s
AI-assisted analysis of HelloZeroNet/ZeroNet@454c0b2e7e (2026-09-02).
Data as JSON: /api/errors/7d3b062719596667.
Report an issue: GitHub.