The bug is almost never where the error message points
A stack trace tells you where your program died, not where it went wrong — and the guard clause your agent adds to make the 500 disappear usually deletes the only signal you had. Here's how to trace a bad value back to its source instead.