ComfyUI Extension: Network Guardian
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
Protects ComfyUI workflows from network interruptions with automatic retry and fallback
Looking for a different extension?
Custom Nodes (0)
README
ComfyUI Network Guardian 🛡️ Never lose work to network interruptions again. Network Guardian is a ComfyUI custom node that protects your workflows from network failures by intercepting file operations, implementing retry logic, and automatically falling back to local storage when network paths become unavailable.
🎯 Problem Solved
Have you ever:
Lost hours of rendering because your NAS went to sleep? Had queues crash when WiFi dropped? Wasted time re-running workflows after network cable issues? Frustrated by SMB shares timing out during generation?
Network Guardian solves all of these.
✨ Features
Zero Configuration Required - Works out of the box Universal Protection - Works with ALL nodes and custom nodes Intelligent Retry Logic - Automatically retries failed operations Automatic Fallback - Saves to local storage when network fails Cross-Platform - Windows, Linux, and macOS support Network Signal Support - Optional server-side reconnection notifications Statistics Tracking - Monitor protection activity Future-Proof - Never breaks with ComfyUI updates
🚀 Quick Start Install via ComfyUI Manager (Recommended)
Open ComfyUI Manager Search for "Network Guardian" Click Install Restart ComfyUI Done! You're protected.
Manual Installation bashcd ComfyUI/custom_nodes git clone https://github.com/pdale-boop/ComfyUI-Network-Guardian cd ComfyUI-NetworkGuardian python install.py
Restart ComfyUI
📖 How It Works Network Guardian intercepts file operations at the Python level before any library tries to access files:
Detection - Automatically identifies network paths Retry Logic - Attempts operation 3 times with delays Fallback - If all retries fail, saves to local directory Transparent - Your workflow continues without interruption
ComfyUI saves file → Network Guardian intercepts → Retry if needed → Fallback if necessary → Success! 🔧 Configuration Network Guardian works without configuration, but you can customize it by creating a config.json file: json{ "fallback_directory": null, "max_retries": 3, "retry_delay_seconds": 1, "network_indicators": ["Z:", "\\", "/mnt/", "/Volumes/", "smb://", "cifs://", "nfs://"], "log_to_file": true, "verbose": false, "enable_network_signal": true, "network_signal_port": 8190 } Configuration Options
fallback_directory: Where to save files when network fails (default: auto-detect ComfyUI/output_temp) max_retries: Number of retry attempts before fallback (default: 3) retry_delay_seconds: Seconds between retry attempts (default: 1) network_indicators: Patterns that identify network paths log_to_file: Enable logging to file (default: true) verbose: Print all operations for debugging (default: false) enable_network_signal: Listen for server reconnection signals (default: true) network_signal_port: Port for signal listener (default: 8190)
- Right-click on the ComfyUI canvas
- Search for "Network Guardian" or navigate to utils category
- Add "Network Guardian Status 🛡️" node to your workflow
Viewing the Output
The status node outputs statistics as a STRING. To view it in ComfyUI:
Option 1: Connect to a Preview Node
- Add a text preview node:
- Right-click → Add Node → Search "primitive"
- Or search for "preview any", "show text", "display text"
- Connect the STRING output from Network Guardian Status to the preview node
- Queue/run your workflow
- The stats will display in the preview node
Option 2: Check the Console The node also prints statistics to the ComfyUI console:
View in systemd logs
sudo journalctl -u comfyui-backend.service -f | grep "Network Guardian Status"
Or check the log file
tail -f ~/ComfyUI/user/comfyui.log
What You'll See
=== Network Guardian Status === Protected Operations: Network Failures Caught: Successful Retries: Fallback Saves:
Network Signals: Enabled: Yes Port: Received: Last Signal:
Fallback Directory:
🖥️ Server-Side Signals (Optional) For instant recovery when network reconnects, you can run a notifier on your server: Quick Setup
Edit server_signal_notifier.py with your client IPs:
pythonCLIENT_IPS = [ "192.168.1.100", # Your Windows/Mac IP ]
Run on your server:
bashpython3 server_signal_notifier.py Install as Systemd Service (Linux) bash# Copy and edit the service file sudo cp comfyui-network-notifier.service /etc/systemd/system/ sudo nano /etc/systemd/system/comfyui-network-notifier.service
Edit USER and paths in the file, then:
sudo systemctl daemon-reload sudo systemctl enable comfyui-network-notifier sudo systemctl start comfyui-network-notifier
Check status
sudo systemctl status comfyui-network-notifier Firewall Configuration Windows: powershellNew-NetFirewallRule -DisplayName "ComfyUI Guardian" -Direction Inbound -Protocol TCP -LocalPort 8190 -Action Allow Linux: bashsudo ufw allow 8190/tcp
or
sudo firewall-cmd --permanent --add-port=8190/tcp sudo firewall-cmd --reload macOS: bash# System Preferences > Security & Privacy > Firewall > Firewall Options
Add Python and allow incoming connections
🔍 Troubleshooting Files saved to fallback, how do I sync back? Windows: powershellrobocopy "C:\ComfyUI\output_temp" "Z:\output" /E /MOVE Linux/macOS: bashrsync -av --remove-source-files ComfyUI/output_temp/ /mnt/server/output/ See COMPANION_TOOLS.md for automated sync scripts. Network path not detected Add your pattern to config.json: json{ "network_indicators": ["Z:", "\\myserver", "/mnt/nas", "YOUR_PATTERN_HERE"] } Enable verbose logging Set "verbose": true in config.json and restart ComfyUI to see all operations. Port conflict for signal listener Change network_signal_port in config.json to an available port (e.g., 8191). Check if it's working
Add the "Network Guardian Status" node to your workflow Or check the log: ComfyUI/output_temp/network_guardian.log Or view stats: ComfyUI/output_temp/network_guardian_stats.json
🎓 Use Cases
Home Lab with NAS - Protects against NAS sleep/hibernation WiFi Connections - Handles WiFi drops gracefully Distributed Setup - Multiple machines sharing network storage Cloud Storage - Works with OneDrive, Dropbox, Google Drive Server Maintenance - Continue working during server downtime
🧪 Technical Details What Gets Protected Network Guardian patches these Python operations:
builtins.open() - All open() calls io.open() - Explicit io module usage Path.write_bytes() - Pathlib binary writes Path.write_text() - Pathlib text writes os.path.exists() - Path existence checks os.path.isdir() - Directory checks os.path.isfile() - File checks
Network Path Detection Automatically detects:
Windows: Z:, Y:, UNC paths (\server\share) Linux: /mnt/, /media/, smb://, cifs://, nfs:// macOS: /Volumes/, AFP paths Custom: User-defined patterns in config
Error Detection Identifies network errors by:
Windows error codes: 53, 64, 1231, 59, 1326, 1219 Error messages: "network", "path not found", "access is denied" Exception types: OSError, IOError, PermissionError
Performance Impact
Local paths: ~0.001ms overhead (negligible) Network paths (normal): ~0.01ms overhead (negligible) Network paths (failure): 3-4 seconds for retries (one-time per failure) Memory usage: < 1MB typical, < 5MB maximum
📋 Compatibility Platforms PlatformPython 3.8Python 3.9Python 3.10Python 3.11Python 3.12Windows 10/11✅✅✅✅✅Ubuntu 20.04+✅✅✅✅✅Debian 11+✅✅✅✅✅macOS 11+✅✅✅✅✅ ComfyUI Versions
✅ All versions supported ✅ Works with ALL custom nodes ✅ Future-proof design (doesn't depend on ComfyUI internals)
🤝 Contributing Contributions welcome! Here's how:
Fork the repository Create feature branch (git checkout -b feature/amazing-feature) Commit changes (git commit -m 'Add amazing feature') Push to branch (git push origin feature/amazing-feature) Open Pull Request
Reporting Bugs Please include:
OS and version Python version ComfyUI version Network Guardian version Log file excerpt (ComfyUI/output_temp/network_guardian.log) Steps to reproduce
📝 License GNU General Public License v3.0 - See LICENSE file for details. This ensures the project remains open source and any modifications must also be open source. 🙏 Credits Created by: pdale-boop Developed with assistance from: Claude (Anthropic AI) Inspired by: Real-world network reliability challenges in ComfyUI workflows Special thanks to: The ComfyUI community for inspiration and feedback 🆘 Support
🐛 Report Issues 💬 Discussions 📖 Wiki
📚 Documentation
Installation Guide Configuration Reference Troubleshooting Guide Companion Tools
🗺️ Roadmap v1.1 (Planned)
Web UI configuration panel Automatic sync scheduler Email/webhook notifications Network health dashboard
v1.2 (Future)
Integration with ComfyUI Manager settings Advanced retry strategies (exponential backoff) Bandwidth monitoring Multi-fallback locations
v2.0 (Long-term)
Built-in network drive mounting Cross-machine queue distribution Cloud storage direct integration Mobile app for monitoring
📜 Changelog v1.0.0 (2025-01-15)
✨ Initial release ✨ Filesystem interception system ✨ Retry logic with configurable delays ✨ Automatic fallback to local storage ✨ Network signal listener ✨ Cross-platform support (Windows, Linux, macOS) ✨ Statistics tracking ✨ Status node for monitoring
❓ FAQ Q: Does this replace network drive mounting? A: No, it assumes your network storage is already mounted. It handles failures after mounting. Q: Will this slow down my renders? A: No. For local paths there's virtually zero overhead. Network paths work at normal speed. Q: What happens to files in fallback? A: They stay there until you manually sync them back. Use provided sync scripts or manual rsync/robocopy. Q: Can I use this with cloud storage? A: Yes! Works with OneDrive, Dropbox, Google Drive with local sync folders. Q: Does it work with custom nodes? A: Yes! It protects ALL file operations, regardless of which node makes them. Q: Will ComfyUI updates break this? A: No. It intercepts at Python level, not ComfyUI level. Update-proof design. Q: Can multiple machines use the same fallback? A: No, each machine needs its own fallback directory to avoid conflicts. Q: Does it work for reading files? A: It protects read operations from crashing, but won't create fallback files (can't read what doesn't exist). Q: How do I know it's working? A: Add "Network Guardian Status" node to your workflow, or check the log file. Q: Is it safe? A: Yes. It only affects file operations. Your workflows remain unchanged. All operations are logged.
🛡️ Stay Protected. Stay Productive. Never Lose Work Again. 🛡️
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.