External "Run on torrent added" does not wait for metadata download any more #17068

Open
opened 2026-02-22 03:39:05 -05:00 by deekerman · 0 comments
Owner

Originally created by @mortiis on GitHub (Aug 10, 2025).

qBittorrent & operating system versions

qBittorrent: v5.1.2 WebUI (64-bit) from lscr.io/linuxserver/qbittorrent:latest
Operating system: Linux df8de3c2647a 6.12.34+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.34-1+rpt1~bookworm (2025-06-26) aarch64 GNU/Linux
Qt: 6.9.1
Libtorrent: 2.0.11.0
Boost: 1.84.0
OpenSSL: 3.5.2
zlib: 1.3.1

What is the problem?

I have a Python script checking file extensions in added torrents (magnets) that has been working, but sometime in the past few months it has silently stopped working.

Previously the API call (client.torrents_files(hash=torrent.hash)) has returned a file list as expected, but didn't anymore until I added a sleep() before requesting the file list to allow time for metadata download.

I tried adding "%C" (number of files) to the external script call which passes -1, presumably because the metadata is missing.

Thanks in advance for any pointers on this, hope I'm not missing anything obvious.

Steps to reproduce

  1. Add a script to "Run on torrent added" that requests the torrent file list.
  2. The file list is empty.
  3. Try the script again, but with an added sleep() that allows for the metadata to download.
  4. The file list is populated.

Additional context

No response

Log(s) & preferences file(s)

[Application]
FileLogger\Age=1
FileLogger\AgeType=1
FileLogger\Backup=true
FileLogger\DeleteOld=true
FileLogger\Enabled=true
FileLogger\MaxSizeBytes=66560
FileLogger\Path=/config/qBittorrent/logs
MemoryWorkingSetLimit=1024

[AutoRun]
OnTorrentAdded\Enabled=true
OnTorrentAdded\Program=/config/py-env/bin/python3 /config/script.py \"%N\"
enabled=true
program=/config/py-env/bin/python3 /config/test.py \"%N\" \"%L\"

[BitTorrent]
MergeTrackersEnabled=true
Session\AddExtensionToIncompleteFiles=false
Session\AddTorrentStopped=false
Session\AnonymousModeEnabled=false
Session\AsyncIOThreadsCount=16
Session\Categories=@Variant(\0\0\0\b\0\0\0\x1\0\0\0\x12\0t\0v\0-\0s\0o\0n\0\x61\0r\0r\0\0\0\n\xff\xff\xff\xff)
Session\CheckingMemUsageSize=128
Session\ConnectionSpeed=100
Session\DHTEnabled=true
Session\DefaultSavePath=/data/Downloads/completed
Session\DiskQueueSize=83886080
Session\ExcludedFileNames=
Session\FilePoolSize=200
Session\GlobalDLSpeedLimit=3778
Session\GlobalMaxRatio=-1
Session\GlobalMaxSeedingMinutes=-1
Session\GlobalUPSpeedLimit=180
Session\IDNSupportEnabled=true
Session\IgnoreLimitsOnLAN=false
Session\IgnoreSlowTorrentsForQueueing=true
Session\Interface=tun0
Session\InterfaceAddress=0.0.0.0
Session\InterfaceName=tun0
Session\LSDEnabled=true
Session\MaxActiveDownloads=15
Session\MaxActiveTorrents=500
Session\MaxActiveUploads=500
Session\MaxConnections=200
Session\MaxConnectionsPerTorrent=60
Session\MaxUploads=16
Session\MaxUploadsPerTorrent=4
Session\MultiConnectionsPerIp=true
Session\PeXEnabled=true
Session\PeerTurnover=10
Session\PeerTurnoverCutOff=60
Session\PeerTurnoverInterval=100
Session\PerformanceWarning=false
Session\Port=46920
Session\QueueingSystemEnabled=true
Session\RequestQueueSize=200
Session\SSL\Port=28446
Session\SSRFMitigation=false
Session\SaveResumeDataInterval=30
Session\ShareLimitAction=Stop
Session\SlowTorrentsDownloadRate=150
Session\SlowTorrentsInactivityTimer=30
Session\SlowTorrentsUploadRate=10
Session\TempPath=/data/Downloads/leeching
Session\TempPathEnabled=true
Session\TorrentContentRemoveOption=MoveToTrash
Session\UseAlternativeGlobalSpeedLimit=false
Session\ValidateHTTPSTrackerCertificate=false
Session\uTPRateLimited=true
TorrentFileSizeLimit=16777216

[Core]
AutoDeleteAddedTorrentFile=Never

[Meta]
MigrationVersion=8

[Network]
Cookies=
PortForwardingEnabled=false
Proxy\OnlyForTorrents=false

[Preferences]
Advanced\AnonymousMode=true
Advanced\IgnoreLimitsLAN=true
Advanced\RecheckOnCompletion=true
Advanced\trackerPort=9000
Advanced\trackerPortForwarding=false
Bittorrent\MaxRatio=1
Bittorrent\uTP_rate_limited=true
Connection\GlobalDLLimit=2506
Connection\GlobalUPLimit=75
Connection\PortRangeMin=31778
Connection\ResolvePeerCountries=true
Downloads\SavePath=/data/
Downloads\UseIncompleteExtension=false
DynDNS\DomainName=changeme.dyndns.org
DynDNS\Enabled=false
DynDNS\Password=
DynDNS\Service=DynDNS
DynDNS\Username=
General\DeleteTorrentsFilesAsDefault=false
General\Locale=en
General\UseRandomPort=true
MailNotification\email=
MailNotification\enabled=false
MailNotification\password=
MailNotification\req_auth=true
MailNotification\req_ssl=false
MailNotification\sender=qBittorrent_notification@example.com
MailNotification\smtp_server=smtp.changeme.com
MailNotification\username=
Queueing\IgnoreSlowTorrents=true
Queueing\MaxActiveDownloads=15
Queueing\MaxActiveTorrents=10
Queueing\QueueingEnabled=true
WebUI\Address=*
WebUI\AlternativeUIEnabled=false
WebUI\AuthSubnetWhitelist=
WebUI\AuthSubnetWhitelistEnabled=true
WebUI\BanDuration=3600
WebUI\CSRFProtection=true
WebUI\ClickjackingProtection=true
WebUI\CustomHTTPHeaders=
WebUI\CustomHTTPHeadersEnabled=false
WebUI\HTTPS\CertificatePath=
WebUI\HTTPS\Enabled=false
WebUI\HTTPS\KeyPath=
WebUI\HostHeaderValidation=true
WebUI\LocalHostAuth=false
WebUI\MaxAuthenticationFailCount=5
WebUI\Password_PBKDF2=
WebUI\Port=6364
WebUI\ReverseProxySupportEnabled=false
WebUI\RootFolder=
WebUI\SecureCookie=true
WebUI\ServerDomains=*
WebUI\SessionTimeout=3600
WebUI\TrustedReverseProxiesList=
WebUI\UseUPnP=false
WebUI\Username=

[RSS]
AutoDownloader\DownloadRepacks=true
AutoDownloader\SmartEpisodeFilter=s(\\d+)e(\\d+), (\\d+)x(\\d+), "(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})", "(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})"

[SearchEngines]
disabledEngines=jackett, zooqle, legittorrents

[State]
BannedIPs=
Originally created by @mortiis on GitHub (Aug 10, 2025). ### qBittorrent & operating system versions qBittorrent: v5.1.2 WebUI (64-bit) from lscr.io/linuxserver/qbittorrent:latest Operating system: Linux df8de3c2647a 6.12.34+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.34-1+rpt1~bookworm (2025-06-26) aarch64 GNU/Linux Qt: 6.9.1 Libtorrent: 2.0.11.0 Boost: 1.84.0 OpenSSL: 3.5.2 zlib: 1.3.1 ### What is the problem? I have a Python script checking file extensions in added torrents (magnets) that has been working, but sometime in the past few months it has silently stopped working. Previously the API call (`client.torrents_files(hash=torrent.hash)`) has returned a file list as expected, but didn't anymore until I added a `sleep()` before requesting the file list to allow time for metadata download. I tried adding `"%C"` (number of files) to the external script call which passes `-1`, presumably because the metadata is missing. Thanks in advance for any pointers on this, hope I'm not missing anything obvious. ### Steps to reproduce 1. Add a script to "Run on torrent added" that requests the torrent file list. 2. The file list is empty. 3. Try the script again, but with an added `sleep()` that allows for the metadata to download. 4. The file list is populated. ### Additional context _No response_ ### Log(s) & preferences file(s) ``` [Application] FileLogger\Age=1 FileLogger\AgeType=1 FileLogger\Backup=true FileLogger\DeleteOld=true FileLogger\Enabled=true FileLogger\MaxSizeBytes=66560 FileLogger\Path=/config/qBittorrent/logs MemoryWorkingSetLimit=1024 [AutoRun] OnTorrentAdded\Enabled=true OnTorrentAdded\Program=/config/py-env/bin/python3 /config/script.py \"%N\" enabled=true program=/config/py-env/bin/python3 /config/test.py \"%N\" \"%L\" [BitTorrent] MergeTrackersEnabled=true Session\AddExtensionToIncompleteFiles=false Session\AddTorrentStopped=false Session\AnonymousModeEnabled=false Session\AsyncIOThreadsCount=16 Session\Categories=@Variant(\0\0\0\b\0\0\0\x1\0\0\0\x12\0t\0v\0-\0s\0o\0n\0\x61\0r\0r\0\0\0\n\xff\xff\xff\xff) Session\CheckingMemUsageSize=128 Session\ConnectionSpeed=100 Session\DHTEnabled=true Session\DefaultSavePath=/data/Downloads/completed Session\DiskQueueSize=83886080 Session\ExcludedFileNames= Session\FilePoolSize=200 Session\GlobalDLSpeedLimit=3778 Session\GlobalMaxRatio=-1 Session\GlobalMaxSeedingMinutes=-1 Session\GlobalUPSpeedLimit=180 Session\IDNSupportEnabled=true Session\IgnoreLimitsOnLAN=false Session\IgnoreSlowTorrentsForQueueing=true Session\Interface=tun0 Session\InterfaceAddress=0.0.0.0 Session\InterfaceName=tun0 Session\LSDEnabled=true Session\MaxActiveDownloads=15 Session\MaxActiveTorrents=500 Session\MaxActiveUploads=500 Session\MaxConnections=200 Session\MaxConnectionsPerTorrent=60 Session\MaxUploads=16 Session\MaxUploadsPerTorrent=4 Session\MultiConnectionsPerIp=true Session\PeXEnabled=true Session\PeerTurnover=10 Session\PeerTurnoverCutOff=60 Session\PeerTurnoverInterval=100 Session\PerformanceWarning=false Session\Port=46920 Session\QueueingSystemEnabled=true Session\RequestQueueSize=200 Session\SSL\Port=28446 Session\SSRFMitigation=false Session\SaveResumeDataInterval=30 Session\ShareLimitAction=Stop Session\SlowTorrentsDownloadRate=150 Session\SlowTorrentsInactivityTimer=30 Session\SlowTorrentsUploadRate=10 Session\TempPath=/data/Downloads/leeching Session\TempPathEnabled=true Session\TorrentContentRemoveOption=MoveToTrash Session\UseAlternativeGlobalSpeedLimit=false Session\ValidateHTTPSTrackerCertificate=false Session\uTPRateLimited=true TorrentFileSizeLimit=16777216 [Core] AutoDeleteAddedTorrentFile=Never [Meta] MigrationVersion=8 [Network] Cookies= PortForwardingEnabled=false Proxy\OnlyForTorrents=false [Preferences] Advanced\AnonymousMode=true Advanced\IgnoreLimitsLAN=true Advanced\RecheckOnCompletion=true Advanced\trackerPort=9000 Advanced\trackerPortForwarding=false Bittorrent\MaxRatio=1 Bittorrent\uTP_rate_limited=true Connection\GlobalDLLimit=2506 Connection\GlobalUPLimit=75 Connection\PortRangeMin=31778 Connection\ResolvePeerCountries=true Downloads\SavePath=/data/ Downloads\UseIncompleteExtension=false DynDNS\DomainName=changeme.dyndns.org DynDNS\Enabled=false DynDNS\Password= DynDNS\Service=DynDNS DynDNS\Username= General\DeleteTorrentsFilesAsDefault=false General\Locale=en General\UseRandomPort=true MailNotification\email= MailNotification\enabled=false MailNotification\password= MailNotification\req_auth=true MailNotification\req_ssl=false MailNotification\sender=qBittorrent_notification@example.com MailNotification\smtp_server=smtp.changeme.com MailNotification\username= Queueing\IgnoreSlowTorrents=true Queueing\MaxActiveDownloads=15 Queueing\MaxActiveTorrents=10 Queueing\QueueingEnabled=true WebUI\Address=* WebUI\AlternativeUIEnabled=false WebUI\AuthSubnetWhitelist= WebUI\AuthSubnetWhitelistEnabled=true WebUI\BanDuration=3600 WebUI\CSRFProtection=true WebUI\ClickjackingProtection=true WebUI\CustomHTTPHeaders= WebUI\CustomHTTPHeadersEnabled=false WebUI\HTTPS\CertificatePath= WebUI\HTTPS\Enabled=false WebUI\HTTPS\KeyPath= WebUI\HostHeaderValidation=true WebUI\LocalHostAuth=false WebUI\MaxAuthenticationFailCount=5 WebUI\Password_PBKDF2= WebUI\Port=6364 WebUI\ReverseProxySupportEnabled=false WebUI\RootFolder= WebUI\SecureCookie=true WebUI\ServerDomains=* WebUI\SessionTimeout=3600 WebUI\TrustedReverseProxiesList= WebUI\UseUPnP=false WebUI\Username= [RSS] AutoDownloader\DownloadRepacks=true AutoDownloader\SmartEpisodeFilter=s(\\d+)e(\\d+), (\\d+)x(\\d+), "(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})", "(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})" [SearchEngines] disabledEngines=jackett, zooqle, legittorrents [State] BannedIPs= ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#17068
No description provided.