Troubleshooting Guide¶
This guide covers common issues, debugging techniques, and solutions for qbit-guard deployment and operation.
Before You Start
Always check the logs first: docker-compose logs qbit-guard
or kubectl logs deployment/qbit-guard
Container Issues¶
Container Fails to Start¶
Symptoms
Container exits immediately or fails to start
Invalid environment variables (check
QBIT_HOST
, credentials)Network connectivity issues between containers
Missing required environment variables (
SONARR_APIKEY
, etc.)qBittorrent WebUI not enabled or accessible
Verify all required environment variables are set
Test qBittorrent connectivity
Bash Enable qBittorrent WebUI: Options → Web UI → Enable
Validate API keys for Sonarr/Radarr in their respective settings
qbit-guard Cannot Connect to qBittorrent¶
Symptoms
Log messages: qB: login failed
or connection timeouts
Fix Steps
- URL Format: Ensure
QBIT_HOST=http://qbittorrent:8080
(not https unless configured) - Credentials: Verify
QBIT_USER
andQBIT_PASS
match WebUI settings exactly - WebUI Settings: qBittorrent Options → Web UI → Enable Web User Interface
- Network: Ensure containers are on the same Docker network
- Firewall: Check if host firewall is blocking container communication
No Torrents Being Processed¶
Symptoms
Container runs but doesn't process any torrents
Common Fixes
- Categories: Ensure
QBIT_ALLOWED_CATEGORIES
exactly matches qBittorrent category names - New Torrents: Add a new torrent to an allowed category and watch logs
- Existing Torrents: Set
WATCH_PROCESS_EXISTING_AT_START=1
to process existing torrents - Polling: Verify
WATCH_POLL_SECONDS
is not set too high (default: 3.0)
qBittorrent Container Restarts¶
Symptoms: Watcher gets stuck after qBittorrent restarts, logs show stale request errors
Root Cause: Previous versions couldn't handle qBittorrent container restarts gracefully
Improved Behavior (v2.0+): The watcher now automatically: 1. Detects connection failures from HTTP errors (401, 403, 500-504) 2. Implements exponential backoff retry with configurable delays 3. Resets request ID (rid) to 0 on reconnection 4. Re-authenticates automatically when connection is restored 5. Resumes normal polling after successful reconnection
Configuration:
Bash | |
---|---|
API & Integration Issues¶
docker-compose logs -f qbit-guard | grep "Watcher.*started"
Solutions: 1. Increase timeout values:
2. Use direct container/pod IPs instead of service names if DNS is slow 3. Avoid routing through reverse proxies for *arr API calls 4. Check network latency between containers"Pre-air: No Sonarr history" Messages¶
Symptoms: Frequent messages about missing Sonarr history
Root Cause: Sonarr may not have written history yet, or there are communication issues
Solutions: 1. Set RESUME_IF_NO_HISTORY=1
(default) to proceed anyway 2. Check Sonarr logs for download client communication issues 3. Verify Sonarr → qBittorrent connection is working 4. Increase SONARR_TIMEOUT_SEC
if Sonarr is slow to respond
Internet API Failures¶
Symptoms: TVmaze or TheTVDB API errors
TVmaze Issues: - No auth required, check connectivity to api.tvmaze.com
- Increase TVMAZE_TIMEOUT_SEC
if network is slow
TheTVDB Issues: - Verify TVDB_APIKEY
and optional TVDB_PIN
are correct - Check TheTVDB API status - Ensure bearer token hasn't expired
Workaround: Set INTERNET_CHECK_PROVIDER=off
to disable cross-checking
Container Networking Problems¶
Services Cannot Reach Each Other¶
Solutions: 1. Ensure all services use the same Docker network 2. Use container service names (not localhost/IP addresses) 3. Check for port conflicts 4. Verify firewall rules aren't blocking container communication
Metadata and File Processing Issues¶
Metadata Never Loads¶
Symptoms: Torrents get stuck waiting for metadata (especially magnets)
Debugging:
Bash | |
---|---|
Solutions: 1. Increase METADATA_MAX_WAIT_SEC
or set to 0 for infinite wait 2. Verify magnet has sufficient seeds/peers 3. Try reducing METADATA_POLL_INTERVAL
to 0.5 for faster checking 4. Check qBittorrent's tracker/DHT settings 5. Set download budget limit:
Categories Not Processed¶
Symptoms: Torrents in correct categories aren't being processed
Solutions: 1. Ensure category names in QBIT_ALLOWED_CATEGORIES
exactly match qBittorrent categories 2. Categories are normalized to lowercase for comparison 3. Check qBittorrent logs to verify script is being called with correct parameters 4. Use LOG_LEVEL=DEBUG
to see category matching logic
Performance Issues¶
High Resource Usage¶
Solutions:
Reduce polling frequency:
Limit metadata download:
Set resource limits:
Container Restart Issues¶
Process existing torrents after restart:
Set appropriate restart policy:
YAML | |
---|---|
Health Monitoring¶
Check Container Health¶
Bash | |
---|---|
Log Indicators¶
Success Indicators: - ✅ qB: login OK
- Authentication successful - ✅ Started torrent ... after checks
- Normal allow path - ✅ Watcher.*started
- Polling mode active
Expected Blocking Behavior: - ⚠️ Pre-air: BLOCK
- Expected pre-air blocking behavior - ⚠️ ISO cleanup: removing
- Expected ISO cleanup
Error Indicators: - ❌ Unhandled error
- Configuration or connectivity issue - ❌ qB: login failed
- Authentication problem - ❌ Timeout
- Network connectivity issues
Connection Recovery Indicators: - ⚠️ Connection error (failure N)
- Temporary connection issue detected - ℹ️ Multiple connection failures detected, attempting reconnection
- Reconnection initiated - ✅ Successfully reconnected to qBittorrent
- Connection restored - ❌ Failed to reconnect to qBittorrent, exiting
- Persistent connection failure
Debug Mode¶
Enable Detailed Logging¶
Debug mode shows: - HTTP request/response details - Sonarr/Radarr API communication - File analysis decisions - Whitelist matching logic - Metadata fetch progress
Testing Mode¶
Use dry-run mode to test configuration without deleting torrents:
Example dry-run output:
Text Only | |
---|---|
Common Configuration Issues¶
Environment Variable Problems¶
Issue: Variables not being read properly
Bash | |
---|---|
Solutions: 1. Use quotes around values with special characters 2. Boolean values should be 0
or 1
, not true
/false
3. Ensure no extra spaces in environment variable definitions
Category Matching Issues¶
Issue: Torrents in correct categories aren't processed
Bash | |
---|---|
Solutions: 1. Use exact category names from qBittorrent 2. Separate multiple categories with commas (no spaces) 3. Categories are case-sensitive in configuration
Emergency Procedures¶
Stop Processing Immediately¶
Bash | |
---|---|
Reset to Safe Mode¶
Bash | |
---|---|
Recover from Bad Configuration¶
- Stop qbit-guard:
docker-compose stop qbit-guard
- Fix configuration in docker-compose.yml
- Test with dry-run: Add
QBIT_DRY_RUN=1
- Restart:
docker-compose up -d qbit-guard
- Monitor logs:
docker-compose logs -f qbit-guard
Getting Help¶
Collect Diagnostic Information¶
When seeking help, provide:
Container logs:
Bash Configuration (sanitized):
Environment details:
- Docker and Docker Compose versions
- Operating system
- Network setup (bridge, host, etc.)
qBittorrent version
Steps to reproduce the issue
Best Practices for Support¶
- Enable debug mode first:
LOG_LEVEL=DEBUG
- Test with dry-run:
QBIT_DRY_RUN=1
- Isolate the issue: Test with minimal configuration
- Check logs thoroughly before asking for help
- Provide specific error messages and log excerpts
Next Steps¶
- Development Guide → - Advanced debugging techniques
- Configuration Guide → - Review configuration options
- Examples → - Working configurations for reference