Solutions to common problems and issues with Godot-Torrent.
Symptoms: TorrentSession
class not found
Solutions:
addons/godot-torrent/
folder existsgodot-torrent.gdextension
file is present# Verify library file exists
ls addons/godot-torrent/bin/libgodot-torrent.so # Linux
ls addons/godot-torrent/bin/libgodot-torrent.dll # Windows
ls addons/godot-torrent/bin/libgodot-torrent.dylib # macOS
Symptoms: Compilation fails
Common causes:
Solutions:
# Update submodules
git submodule update --init --recursive
# Install dependencies (Ubuntu/Debian)
sudo apt-get install libboost-all-dev libssl-dev cmake scons
# Clean and rebuild
rm -rf godot-cpp/bin libtorrent/build
./build_local.sh linux
See building-from-source.md for details.
Symptoms: get_num_peers()
returns 0
Solutions:
session.start_dht()
Wait longer - Peer discovery takes time (30-60 seconds)
# Allow port in firewall (Linux)
sudo ufw allow 6881/tcp
sudo ufw allow 6881/udp
handle.add_tracker("udp://tracker.opentrackr.org:1337/announce", 0)
Symptoms: Magnet links added but nothing happens
Solutions:
session.start_dht()
func _process(_delta):
var info = handle.get_torrent_info()
if info and info.is_valid():
print("Metadata received: ", info.get_name())
session.add_dht_node("router.bittorrent.com", 6881)
session.add_dht_node("dht.transmissionbt.com", 6881)
Symptoms: Progress stays at 0%
Checks:
if not handle or not handle.is_valid():
push_error("Invalid handle")
var status = handle.get_status()
print("State: ", status.get_state_string())
# Should be "downloading" not "paused"
if handle.is_paused():
handle.resume()
var info = handle.get_torrent_info()
for i in range(info.get_file_count()):
var priority = handle.get_file_priority(i)
if priority == 0:
print("File %d is skipped" % i)
Symptoms: Low download rate, few peers
Solutions:
session.set_download_rate_limit(0) # Unlimited
session.set_max_connections(200)
var status = handle.get_status()
print("Peers: ", status.get_num_peers())
# Should be > 0, ideally 20+
Verify torrent health - Torrents with few seeders are naturally slow
Symptoms: Download stops progressing
Solutions:
var alerts = session.get_alerts()
for alert in alerts:
if alert.get("category") == "error":
print("Error: ", alert.get("message"))
handle.force_recheck()
df -h # Check available space
Symptoms: Upload rate is 0
Solutions:
var status = handle.get_status()
if not status.is_finished():
print("Still downloading, limited upload")
session.set_upload_rate_limit(0)
session.set_max_uploads(8)
Verify port forwarding - Essential for uploading
Symptoms: Godot uses excessive CPU
Solutions:
var update_interval = 2.0 # Update every 2 seconds
session.set_max_connections(50)
logger.set_log_level(TorrentLogger.WARNING)
# Pause torrents when not needed
handle.pause()
Symptoms: Memory usage grows over time
Solutions:
session.remove_torrent(handle, false)
var max_active = 5
if active_torrents.size() > max_active:
# Pause or remove some
session.clear_alerts()
handle.flush_cache()
Causes:
Solutions:
session.set_listen_port_range(6889, 6899)
netstat -tuln | grep 6881
Causes:
Solutions:
file example.torrent # Should say "BitTorrent file"
Re-download torrent file
Cause: Empty or invalid download path
Solution:
# Use valid path
var path = "user://downloads"
# or
var path = "/home/user/downloads" # Absolute path
# Ensure directory exists
var dir = DirAccess.open("user://")
if not dir.dir_exists("downloads"):
dir.make_dir("downloads")
var logger = TorrentLogger.new()
logger.enable_logging(true)
logger.set_log_level(TorrentLogger.DEBUG)
logger.set_log_file("user://debug.log")
session.set_logger(logger)
func _process(_delta):
var alerts = session.get_alerts()
for alert in alerts:
print("[%s] %s: %s" % [
alert.get("category"),
alert.get("type_name"),
alert.get("message")
])
session.clear_alerts()
func debug_handle(handle: TorrentHandle):
if not handle:
print("Handle is null")
return
if not handle.is_valid():
print("Handle is invalid")
return
var status = handle.get_status()
if not status:
print("Cannot get status")
return
print("=== Torrent Debug Info ===")
print("Name: ", handle.get_name())
print("State: ", status.get_state_string())
print("Progress: %.2f%%" % (status.get_progress() * 100))
print("Download rate: %d B/s" % status.get_download_rate())
print("Upload rate: %d B/s" % status.get_upload_rate())
print("Peers: %d" % status.get_num_peers())
print("Seeds: %d" % status.get_num_seeds())
print("Is paused: %s" % status.is_paused())
print("Is finished: %s" % status.is_finished())
Use public domain test torrent:
# Sintel movie trailer (legal, well-seeded)
var test_magnet = "magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10"
var handle = session.add_magnet_uri(test_magnet, "user://test")
If you’re still stuck:
if handle and handle.is_valid():
# Safe to use
session.start_dht()
func _exit_tree():
if session:
session.stop_session()
Wait for metadata with magnet links - It takes time!
Still need help? See Getting Started for basics or open an issue.