This guide provides solutions to common issues you may encounter when working with Bench.
Common Issues and Solutions
Bench Init Failures
Issue: Permission denied during init
Error:
Permission denied: '/home/user/frappe-bench'
Solution:
-
Check directory permissions:
-
Ensure you own the parent directory:
sudo chown -R $USER:$USER ~/
-
Don’t use sudo with bench init:
bench init frappe-bench # Correct
sudo bench init frappe-bench # Wrong
Issue: Python version error
Error:
Python 3.8 or higher required
Solution:
-
Check Python version:
-
Specify Python path:
bench init frappe-bench --python python3.10
-
Install newer Python:
# Ubuntu/Debian
sudo apt update
sudo apt install python3.10 python3.10-venv
Issue: Node.js version incompatible
Error:
Node version must be >= 18
Solution:
-
Install Node.js 18+:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
-
Verify installation:
node --version
npm --version
Database Issues
Issue: Cannot connect to database
Error:
Access denied for user 'root'@'localhost'
Solution:
-
Check MariaDB is running:
sudo systemctl status mariadb
sudo systemctl start mariadb
-
Verify root password:
-
Reset MariaDB root password:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
FLUSH PRIVILEGES;
EXIT;
-
Update bench config:
# Edit sites/common_site_config.json
{
"db_host": "localhost",
"db_port": 3306
}
Issue: Database already exists
Error:
Solution:
-
Drop existing database:
bench drop-site sitename.com
-
Or use —force flag:
bench new-site sitename.com --force
-
Or manually drop in MySQL:
DROP DATABASE `_1234567890abcdef`;
Issue: Database connection timeout
Error:
OperationalError: (2003, "Can't connect to MySQL server")
Solution:
-
Check MySQL is listening:
sudo netstat -tlnp | grep 3306
-
Verify bind address in MariaDB config:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Change:
-
Restart MariaDB:
sudo systemctl restart mariadb
Port Conflicts
Issue: Port already in use
Error:
[ERROR] Port 8000 already in use
Solution:
-
Find process using port:
lsof -ti:8000
sudo netstat -tlnp | grep :8000
-
Kill the process:
-
Or change bench port in
sites/common_site_config.json:
{
"webserver_port": 8080,
"socketio_port": 9001
}
-
Restart bench:
Issue: Redis port conflict
Error:
Redis connection failed on port 11000
Solution:
-
Check Redis processes:
-
Regenerate Redis config:
-
Restart Redis:
Permission Errors
Issue: Permission denied on files
Error:
PermissionError: [Errno 13] Permission denied: 'sites/assets'
Solution:
-
Fix ownership:
sudo chown -R $USER:$USER ~/frappe-bench
-
Fix permissions:
find ~/frappe-bench -type d -exec chmod 755 {} \;
find ~/frappe-bench -type f -exec chmod 644 {} \;
chmod +x ~/frappe-bench/env/bin/*
Issue: Cannot write to logs
Error:
Permission denied: 'logs/bench.log'
Solution:
-
Create logs directory:
mkdir -p ~/frappe-bench/logs
-
Set permissions:
chmod 755 ~/frappe-bench/logs
Issue: Sites directory permission error
Error:
OSError: [Errno 13] Permission denied: 'sites/sitename'
Solution:
-
Fix sites directory:
sudo chown -R $USER:$USER ~/frappe-bench/sites
chmod 755 ~/frappe-bench/sites
-
For production setup:
sudo bench setup production frappe --user $USER
Asset Build Failures
Issue: Build fails with memory error
Error:
JavaScript heap out of memory
Solution:
-
Increase Node.js memory:
export NODE_OPTIONS="--max-old-space-size=4096"
bench build
-
Or build apps individually:
bench build --app frappe
bench build --app erpnext
Issue: Module not found during build
Error:
Error: Cannot find module 'rollup'
Solution:
-
Install Node dependencies:
bench setup requirements --node
-
Clear node_modules and reinstall:
rm -rf apps/frappe/node_modules
cd apps/frappe
yarn install
cd ../..
bench build
Issue: Sass compilation error
Error:
Solution:
-
Clear cache:
bench --site all clear-cache
-
Force rebuild:
-
Reinstall Python dependencies:
bench setup requirements --python
Production Issues
Issue: Supervisor not starting
Error:
supervisorctl: command not found
Solution:
-
Install supervisor:
sudo apt-get install supervisor
-
Check supervisor status:
sudo systemctl status supervisor
sudo systemctl start supervisor
-
Regenerate config:
bench setup supervisor
sudo supervisorctl reread
sudo supervisorctl update
Issue: NGINX configuration error
Error:
nginx: configuration file test failed
Solution:
-
Test NGINX config:
-
Check for syntax errors:
-
Regenerate NGINX config:
-
Check error details:
sudo tail -f /var/log/nginx/error.log
Issue: Workers not processing jobs
Error:
Background jobs stuck in queue
Solution:
-
Check worker status:
sudo supervisorctl status
-
Restart workers:
sudo supervisorctl restart all
-
Check worker logs:
tail -f logs/worker.error.log
-
Clear job queue:
bench --site sitename clear-cache
bench --site sitename clear-queue
SSL Certificate Issues
Issue: Certbot command not found
Error:
Solution:
-
Install certbot:
# Ubuntu/Debian
sudo apt-get install certbot python3-certbot-nginx
-
Verify installation:
Issue: Certificate verification failed
Error:
Failed authorization procedure
Solution:
-
Verify DNS is pointing to server:
-
Ensure port 80 is open:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
-
Check NGINX is running:
sudo systemctl status nginx
-
Try standalone mode:
sudo systemctl stop nginx
sudo certbot certonly --standalone -d sitename.com
sudo systemctl start nginx
Issue: DNS multitenancy not enabled
Error:
You cannot setup SSL without DNS Multitenancy
Solution:
-
Enable multitenancy:
bench config dns_multitenant on
-
Regenerate config:
bench setup nginx
sudo bench setup reload-nginx
Update Issues
Issue: Update fails with merge conflicts
Error:
error: Your local changes would be overwritten by merge
Solution:
-
Stash local changes:
cd apps/frappe
git stash
cd ../..
bench update --pull
-
Or reset to remote:
cd apps/frappe
git reset --hard origin/version-15
cd ../..
bench update
Resetting will lose local changes. Ensure you have backups.
Issue: Migration fails
Error:
Migration failed for site
Solution:
-
Check error logs:
-
Backup first:
bench --site sitename backup
-
Try manual migration:
bench --site sitename migrate
-
If fails, restore backup:
bench --site sitename restore /path/to/backup.sql.gz
Issue: Dependencies not updating
Error:
ImportError: No module named 'module_name'
Solution:
-
Update requirements:
-
Update specific app requirements:
bench setup requirements --app erpnext
-
Reinstall pip packages:
./env/bin/pip install -r apps/frappe/requirements.txt --upgrade
Log Locations
Knowing where to look for logs is crucial for debugging:
Bench logs
# Main bench log
logs/bench.log
# Web server errors
logs/web.error.log
# Worker errors
logs/worker.error.log
# Worker output
logs/worker.log
System logs
# Supervisor
sudo tail -f /var/log/supervisor/supervisord.log
# NGINX access
sudo tail -f /var/log/nginx/access.log
# NGINX errors
sudo tail -f /var/log/nginx/error.log
# MariaDB errors
sudo tail -f /var/log/mysql/error.log
# System log
sudo tail -f /var/log/syslog
Application logs
# Site error logs
tail -f sites/sitename/logs/error.log
# Site request logs
tail -f sites/sitename/logs/web.access.log
Check bench health
bench version
bench config dns_multitenant
bench --site all list-apps
Monitor processes
# Check running processes
ps aux | grep frappe
ps aux | grep redis
ps aux | grep nginx
# Monitor resource usage
top
htop
Database inspection
# Connect to site database
bench --site sitename mariadb
# Show tables
SHOW TABLES;
# Check specific table
SELECT * FROM tabUser LIMIT 10;
Redis inspection
# Connect to Redis
redis-cli -p 13000
# Check keys
KEYS *
# Monitor commands
MONITOR
Cache Issues
Issue: Stale cache causing problems
Solution:
-
Clear site cache:
bench --site sitename clear-cache
-
Clear all sites:
bench --site all clear-cache
-
Clear Redis:
redis-cli -p 13000 FLUSHDB
-
Clear website cache:
bench --site sitename clear-website-cache
Getting Help
If you’re still stuck:
- Check documentation: Review official Frappe/ERPNext docs
- Search forums: https://discuss.frappe.io/
- GitHub issues: Check existing issues on GitHub
- Community chat: Join Frappe Telegram/Discord
- Verbose logs: Run commands with
-v flag for detailed output:
Common Command Quick Reference
# Restart everything
bench restart
# Clear cache and rebuild
bench --site all clear-cache
bench build --force
# Fix permissions
sudo chown -R $USER:$USER ~/frappe-bench
# Check services
sudo supervisorctl status
sudo systemctl status nginx
sudo systemctl status mariadb
# View logs
tail -f logs/bench.log
sudo tail -f /var/log/nginx/error.log
# Database access
bench --site sitename mariadb
# Python console
bench --site sitename console
# Migrate
bench --site sitename migrate
# Backup
bench --site sitename backup --with-files
Next Steps