TIL: HTML Error Responses Can Crash Wails JavaScript Bindings

Problem: I was working on a Wails desktop application and had the Go backend upload a photo to my own API (another service). When the photo failed to upload I didn’t catch that my own upload endpoint was returning an HTML error response instead of JSON. This caused the Javascript VM to show “NeedDebuggerBreak trap” and promises never resolved.

Solution: I didn’t fully debug whether the issue was because the HTML was too large or special characters in the response were causing an issue. The solution was to have the API return a proper JSON response.

Key Lesson: I need to train my eye to catch large HTML dumps in the backend logs instead of looking past them. Always return consistent JSON from API endpoints - even large HTML error responses can break desktop app binding layers.