← Back to writing

04 / writing

Why I'm learning to read stack traces before I panic

The first line of a stack trace is rarely the cause. It is the last place the exception was allowed to travel.

I used to jump to the class I recognised and start editing. That wasted time. The useful order, for me, is now:

  1. Read the exception type and message. They are the spec of what failed.
  2. Walk frames until I hit my package. Framework frames are context, not the bug.
  3. Open that method with the line number and check the values that went in, not the ones I hoped went in.

Panic makes me change code. Reading the trace first usually shows I do not need a rewrite — I need a null check, a missing migration, or a config that never loaded. That is slower in the first thirty seconds and faster for the rest of the afternoon.