{"record":{"id":"9dcf1a390804e6f4","repo":"HelloZeroNet/ZeroNet","slug":"udp-disabled-by-config","errorCode":null,"errorMessage":"Udp disabled by config","messagePattern":"Udp disabled by config","errorType":"exception","errorClass":"AnnounceError","httpStatus":null,"severity":"error","filePath":"plugins/AnnounceBitTorrent/AnnounceBitTorrentPlugin.py","lineNumber":49,"sourceCode":"            trackers = [tracker for tracker in trackers if not tracker.startswith(\"udp://\")]\n\n        return trackers\n\n    def getTrackerHandler(self, protocol):\n        if protocol == \"udp\":\n            handler = self.announceTrackerUdp\n        elif protocol == \"http\":\n            handler = self.announceTrackerHttp\n        elif protocol == \"https\":\n            handler = self.announceTrackerHttps\n        else:\n            handler = super(SiteAnnouncerPlugin, self).getTrackerHandler(protocol)\n        return handler\n\n    def announceTrackerUdp(self, tracker_address, mode=\"start\", num_want=10):\n        s = time.time()\n        if config.disable_udp:\n            raise AnnounceError(\"Udp disabled by config\")\n        if config.trackers_proxy != \"disable\":\n            raise AnnounceError(\"Udp trackers not available with proxies\")\n\n        ip, port = tracker_address.split(\"/\")[0].split(\":\")\n        tracker = UdpTrackerClient(ip, int(port))\n        if helper.getIpType(ip) in self.getOpenedServiceTypes():\n            tracker.peer_port = self.fileserver_port\n        else:\n            tracker.peer_port = 0\n        tracker.connect()\n        if not tracker.poll_once():\n            raise AnnounceError(\"Could not connect\")\n        tracker.announce(info_hash=self.site.address_sha1, num_want=num_want, left=431102370)\n        back = tracker.poll_once()\n        if not back:\n            raise AnnounceError(\"No response after %.0fs\" % (time.time() - s))\n        elif type(back) is dict and \"response\" in back:\n            peers = back[\"response\"][\"peers\"]","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/HelloZeroNet/ZeroNet/blob/454c0b2e7e000fda7000cba49027541fbf327b96/plugins/AnnounceBitTorrent/AnnounceBitTorrentPlugin.py#L31-L67","documentation":"announceTrackerUdp in the AnnounceBitTorrent plugin raises AnnounceError before creating a UdpTrackerClient when config.disable_udp is set. The UDP announce path is explicitly disabled by configuration, so the announce request for a udp:// tracker cannot proceed.","triggerScenarios":"Announcing to a UDP tracker (announceTrackerUdp) while the app config has disable_udp = True.","commonSituations":"Deployment or docker config where UDP was turned off (firewall/NAT problems, server hardening) while torrents still have udp:// trackers; users hitting UDP announces after an ops config change.","solutions":["Set disable_udp = False in the Tribler configuration to enable UDP announces.","Remove udp:// trackers from the torrent, or prefer HTTP(S) trackers.","Update the plugin/config so UDP trackers are filtered out when disabled."],"exampleFix":"# before (Tribler config)\ndisable_udp = True\n# after\ndisable_udp = False","handlingStrategy":"try-catch","validationCode":"def can_announce_udp(config):\n    return not getattr(config, 'disable_udp', False)\n# call before announceTrackerUdp\n","typeGuard":null,"tryCatchPattern":"try:\n    self.announceTrackerUdp(tracker_address, mode)\nexcept AnnounceError as e:\n    if \"Udp disabled by config\" in str(e):\n        logger.warning(\"Skipping UDP announce: disabled by config\")\n    else:\n        raise","preventionTips":["Check config.disable_udp before scheduling UDP announces.","Filter udp:// trackers out of the tracker list when UDP is disabled.","Document the disable_udp setting for deployment ops."],"tags":["bittorrent","udp","config","announce"],"backgroundTag":"udp-disabled-by-config","analyzedSha":"454c0b2e7e000fda7000cba49027541fbf327b96","analyzedAt":"2026-09-02T19:46:57.278Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}