Troubleshooting
Solutions to common issues when using bunqueue.
Installation Issues
”bunqueue requires Bun runtime”
bunqueue only works with Bun, not Node.js.
# Check if Bun is installedbun --version
# Install Bun if neededcurl -fsSL https://bun.sh/install | bashPermission errors on install
# Try with sudo (not recommended)sudo bun add bunqueue
# Better: fix npm permissionsmkdir ~/.bunchown -R $(whoami) ~/.bunDatabase Issues
”SQLITE_BUSY: database is locked”
Multiple processes trying to write simultaneously.
Solutions:
- Use WAL mode (default in bunqueue)
- Ensure only one server instance per database file
- Use server mode for multi-process access
# Check for multiple processeslsof ./data/queue.db
# Kill stale processespkill -f bunqueue”SQLITE_CORRUPT: database disk image is malformed”
Database corruption, usually from crash during write.
Solutions:
- Restore from S3 backup
- Delete and recreate database (data loss)
# Restore from backupbunqueue backup listbunqueue backup restore <key> --force
# Or recreate (loses data)rm ./data/queue.db*bunqueue startDatabase file keeps growing
SQLite doesn’t automatically reclaim space.
# Vacuum the database (run when server is stopped)sqlite3 ./data/queue.db "VACUUM;"
# Enable auto-vacuum (before creating database)sqlite3 ./data/queue.db "PRAGMA auto_vacuum = INCREMENTAL;"Job Processing Issues
Jobs stuck in “active” state
Worker crashed while processing.
Solutions:
- Enable stall detection
- Restart workers
queue.setStallConfig({ enabled: true, stallInterval: 30000, maxStalls: 3,});Jobs not being processed
Check these:
- Is the queue paused?
- Is there a worker for this queue?
- Is rate limiting blocking jobs?
// Check if pausedconst isPaused = queue.isPaused();
// Check countsconst counts = queue.getJobCounts();console.log(counts);
// Check rate limitconst config = queue.getRateLimit();Jobs failing immediately
Check the error in failed event:
worker.on('failed', (job, error) => { console.error('Job failed:', error); console.error('Job data:', job.data); console.error('Attempts:', job.attemptsMade);});Memory usage keeps growing
Possible causes:
- Jobs not being removed after completion
- Too many jobs in DLQ
- Memory leak in processor
// Enable removeOnCompleteawait queue.add('task', data, { removeOnComplete: true,});
// Purge old DLQ entriesqueue.purgeDlq();
// Check for leaks in processorworker.on('completed', () => { console.log('Memory:', process.memoryUsage().heapUsed);});Connection Issues
”Connection refused” to server
Server not running or wrong port.
# Check if server is runningps aux | grep bunqueue
# Check listening portslsof -i :6789lsof -i :6790
# Start serverbunqueue startTCP connection drops
Network issues or server overload.
// Add reconnection logiclet client = createClient();
client.on('error', async () => { await sleep(1000); client = createClient();});Authentication failures
# Check token is setecho $AUTH_TOKENS
# Test with curlcurl -H "Authorization: Bearer your-token" \ http://localhost:6790/healthPerformance Issues
Slow job processing
Optimize:
- Increase worker concurrency
- Use batch operations
- Check database I/O
// Increase concurrencyconst worker = new Worker('queue', processor, { concurrency: 20,});
// Use bulk addawait queue.addBulk([...jobs]);
// Use bulk ackawait queue.ackBatch([...jobIds]);High latency on pull
Check:
- Index on queue table
- Too many delayed jobs
- Database on slow disk
-- Check indexes exist.indices jobs
-- Check delayed jobs countSELECT COUNT(*) FROM jobs WHERE state = 'delayed';Server CPU at 100%
Too many connections or jobs.
# Check connection countbunqueue stats
# Reduce polling frequency# Add backoff in clientsBackup Issues
S3 backup failing
# Check credentialsecho $S3_ACCESS_KEY_IDecho $S3_BUCKET
# Test connectivityaws s3 ls s3://$S3_BUCKET/
# Check logsbunqueue backup statusRestore failing
# List available backupsbunqueue backup list
# Force restore (overwrites existing)bunqueue backup restore <key> --forceCommon Error Messages
| Error | Cause | Solution |
|---|---|---|
SQLITE_BUSY | Database locked | Use single writer |
SQLITE_FULL | Disk full | Free disk space |
ECONNREFUSED | Server not running | Start server |
ETIMEDOUT | Network issue | Check connectivity |
Job not found | Already completed/removed | Check job lifecycle |
Debug Mode
Enable verbose logging:
# Server modeLOG_FORMAT=json DEBUG=bunqueue:* bunqueue start
# Check logstail -f /var/log/bunqueue.logGetting Help
If these solutions don’t help:
- Check GitHub Issues
- Search Discussions
- Open a new issue with:
- bunqueue version
- Bun version
- OS and hardware
- Error message and stack trace
- Minimal reproduction code