QuickBooks Error 502 Bad Gateway occurs when a server acts as a gateway or proxy but receives an invalid response from the upstream server. To fix this, try refreshing the browser, clearing cache and cookies, updating QuickBooks, or checking server status for any downtime or maintenance.