๐ง Auto-Download System Debug Procedures¶
Date: September 2025 Version: 1.0 For: Error diagnosis and troubleshooting
๐ Overview¶
This document provides step-by-step debugging procedures for the Printernizer Auto-Download System, specifically for resolving download failures and backend communication issues.
Note: For backend startup performance issues and slow server initialization, see Startup Performance Analysis.
๐จ Common Error Scenarios¶
Error: "Unknown download status: error"¶
Symptoms:
- Downloads show as failed in management panel
- Error message displays "[object Object]" or "Unknown download status: error"
- Empty download folders in C:\temp\printernizer-download\
- Backend returns status: "error" instead of expected statuses
Root Causes: - Backend API endpoint returning unhandled error statuses - Printer connectivity issues - Printer not in expected state (not printing, no active job) - Backend service failures or timeouts
๐ ๏ธ Debug Tools Available¶
The system includes comprehensive debug utilities loaded automatically:
Debug Commands¶
// Full debug test of specific printer
debugDownload(printerId, printerName)
// Test API endpoint only (no queue processing)
testDownloadAPI(printerId)
// System health and component status check
checkDownloadHealth()
// Clear failed tasks for fresh testing
clearFailedDownloads()
// Start real-time queue monitoring (5-second intervals)
monitorDownloads(5)
// Stop monitoring
stopMonitoringDownloads()
// Export comprehensive debug report
exportDownloadDebug()
๐ Step-by-Step Debugging Process¶
Step 1: Initial System Check¶
- Reload the page to ensure latest code is loaded
- Open browser DevTools (F12) and go to Console tab
- Verify debug tools loaded:
Step 2: System Health Check¶
Expected Output:
๐ฅ Auto-Download System Health Check
๐ค System Status: {status: "active", stats: {...}, components: {...}}
๐ Download Queue Available: true
๐ผ๏ธ Thumbnail Queue Available: true
๐ Logger Available: true
๐ฅ๏ธ UI Available: true
๐ค Manager Available: true
If any component shows false: System initialization failed - check console for startup errors.
Step 3: Test Specific Failing Printer¶
Replace "your-printer-id" with the actual printer ID showing errors:
Analyze the output:
Success Response Example:¶
๐ Testing Download Endpoint for Printer: bambu-a1-001
๐ก Making API call to: /printers/bambu-a1-001/download-current-job
โฑ๏ธ API Response Time: 1250ms
๐ Full Response Object: {status: "success", file_id: "abc123", filename: "test.3mf", has_thumbnail: true}
๐ Status Field: success string
๐งช Testing Download Queue Response Handling...
โ
Would be processed as: SUCCESS
Error Response Example:¶
๐ Testing Download Endpoint for Printer: bambu-a1-001
๐ก Making API call to: /printers/bambu-a1-001/download-current-job
โฑ๏ธ API Response Time: 5000ms
๐ Full Response Object: {status: "error", message: "Printer not responding"}
๐ Status Field: error string
๐งช Testing Download Queue Response Handling...
โ Would throw error: Download failed with error status
๐ Error message would be: Printer not responding
Step 4: Interpret Backend Response¶
Valid Success Statuses:¶
"success"- File downloaded successfully"processed"- File already processed"exists_with_thumbnail"- File exists with thumbnail"exists_no_thumbnail"- File exists without thumbnail
Valid Error Statuses (handled by system):¶
"error"- Generic error (check message field)"failed"- Download operation failed"not_printing"- Printer not currently printing"no_file"- No file available for current job"timeout"- Request timed out"connection_error"- Cannot connect to printer"file_not_found"- File not found on printer"access_denied"- Permission denied
Response Fields to Check:¶
status- Primary status indicatormessage- Human-readable error descriptionerror- Alternative error fieldfile_id- Unique file identifier (for success)filename- Original filename (for success)has_thumbnail- Thumbnail availability boolean
Step 5: Backend Investigation¶
Based on the API response, investigate backend issues:
If status: "error":¶
- Check backend logs for the specific endpoint
- Verify printer connectivity from backend
- Check printer API credentials (access codes, API keys)
- Test printer API directly from backend
If status: "not_printing":¶
- Verify printer is actually printing
- Check printer status from printer's web interface
- Confirm job is active on printer
If status: "connection_error":¶
- Check network connectivity between backend and printer
- Verify printer IP address is correct and reachable
- Test ping/telnet to printer from backend server
- Check firewall rules blocking printer communication
If API call throws exception:¶
- Check backend service is running
- Verify endpoint URL is correct
- Check authentication requirements
- Review backend API logs for errors
Step 6: Clear Failed Tasks and Retry¶
After addressing backend issues:
// Clear old failed attempts
clearFailedDownloads()
// Test with full system integration
debugDownload("your-printer-id", "Debug Test")
Step 7: Monitor Real-time Processing¶
For ongoing issues, monitor the queue in real-time:
// Start monitoring every 5 seconds
monitorDownloads(5)
// Trigger a download and watch processing
// ... trigger download via UI or debugDownload() ...
// Stop monitoring when done
stopMonitoringDownloads()
๐ Debug Report Export¶
For complex issues requiring support:
This exports a comprehensive JSON report containing: - System status and component states - Queue contents and statistics - Recent log entries - Error details - Browser and system information
๐ง Common Solutions¶
Solution 1: Printer Connectivity Issues¶
Problem: status: "connection_error" or API timeouts
Steps: 1. Verify printer IP address in system settings 2. Test ping from backend server to printer 3. Check printer web interface accessibility 4. Verify printer API settings (access codes, etc.) 5. Restart printer network connection if needed
Solution 2: Printer State Issues¶
Problem: status: "not_printing" when printer appears to be printing
Steps: 1. Check printer's actual status via its web interface 2. Verify job is truly active (not paused, completed, or failed) 3. Check if printer is in correct mode for file access 4. Restart print job if needed
Solution 3: Backend Service Issues¶
Problem: API call exceptions or status: "error" with generic messages
Steps: 1. Check backend service health and logs 2. Verify API endpoint implementation is correct 3. Test API authentication and permissions 4. Check database connectivity if backend uses DB 5. Restart backend service if necessary
Solution 4: File Access Issues¶
Problem: status: "file_not_found" or status: "access_denied"
Steps: 1. Verify file actually exists on printer 2. Check printer file permissions and access rights 3. Confirm backend has proper credentials for file access 4. Check if file is locked or in use by printer 5. Verify file path and naming conventions
๐ Monitoring and Prevention¶
Regular Health Checks¶
// Daily health check
checkDownloadHealth()
// Weekly queue status
window.downloadQueue.getStats()
window.thumbnailQueue.getStats()
// Monthly log analysis
window.downloadLogger.getPerformanceMetrics(30)
Proactive Monitoring Setup¶
// Set up automatic monitoring alerts
setInterval(() => {
const stats = window.downloadQueue.getStats();
if (stats.failed > 10) {
console.warn('๐จ High failure rate detected:', stats);
}
}, 300000); // Check every 5 minutes
๐ Documentation Updates¶
When resolving issues:
- Document the specific error encountered
- Record the backend response details
- Note the solution that worked
- Update this document with new scenarios
- Share findings with the development team
๐ Escalation Procedures¶
If debugging doesn't resolve the issue:
- Export debug report using
exportDownloadDebug() - Capture backend logs for the timeframe of errors
- Document exact steps that reproduce the issue
- Note system environment details (OS, browser, network)
- Provide printer model and firmware version information
๐ Version History¶
- v1.0 (Sept 2025): Initial debug procedures for "Unknown download status: error"
Quick Reference¶
Most Common Debug Commands¶
// Quick system check
checkDownloadHealth()
// Test specific printer
testDownloadAPI("printer-id-here")
// Clear and retry
clearFailedDownloads()
debugDownload("printer-id-here", "Test Name")
// Export for support
exportDownloadDebug()
Key Log Locations¶
- Frontend Console: Browser DevTools โ Console
- Backend Logs: Check backend service logs for
/printers/{id}/download-current-jobendpoint - Printer Logs: Check printer's web interface or log files
- Download Logs: Exported via
exportDownloadDebug()