HelloZeroNet/ZeroNet · error · AnnounceError

Udp trackers not available with proxies

Error message

Udp trackers not available with proxies

What it means

announceTrackerUdp raises AnnounceError when config.trackers_proxy is not "disable". UDP tracker traffic cannot be routed through the configured SOCKS/proxy support, so announcing over UDP while a proxy is enabled is rejected up front.

Source

Thrown at plugins/AnnounceBitTorrent/AnnounceBitTorrentPlugin.py:51

        return trackers

    def getTrackerHandler(self, protocol):
        if protocol == "udp":
            handler = self.announceTrackerUdp
        elif protocol == "http":
            handler = self.announceTrackerHttp
        elif protocol == "https":
            handler = self.announceTrackerHttps
        else:
            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)

View on GitHub (pinned to 454c0b2e7e)

Solutions

  1. Set trackers_proxy = "disable" in config to allow UDP announces (loses proxy anonymity).
  2. Replace udp:// trackers with http(s):// trackers that are supported under proxy mode.
  3. Filter out UDP trackers before announcing when proxies are enabled.

Example fix

# before
trackers_proxy = SOCKS5
# after (to allow UDP announces)
trackers_proxy = disable
Defensive patterns

Strategy: try-catch

Validate before calling

def can_announce_udp_with_proxy(config):
    return getattr(config, 'trackers_proxy', 'disable') == 'disable'
# call before announceTrackerUdp

Try / catch

try:
    self.announceTrackerUdp(tracker_address, mode)
except AnnounceError as e:
    if "Udp trackers not available with proxies" in str(e):
        logger.warning("Skipping UDP announce while proxy is enabled")
    else:
        raise

Prevention

When it happens

Trigger: Announcing to a udp:// tracker while the config has trackers_proxy set to anything other than "disable" (e.g. SOCKS5 proxy enabled for anonymity).

Common situations: Running Tribler with its proxy/anonymity features enabled (trackers_proxy = SOCKS5) while a torrent still contains udp:// trackers; users combining proxy mode with legacy UDP trackers.

Related errors


AI-assisted analysis of HelloZeroNet/ZeroNet@454c0b2e7e (2026-09-02). Data as JSON: /api/errors/bd5620a56537662f. Report an issue: GitHub.