Report #902
[bug\_fix] panic: runtime error: invalid memory address or nil pointer dereference
Guard every pointer dereference with a nil check, use the \`v, ok := x.\(T\)\` form for type assertions, and make constructors return concrete non-nil pointers. Enable \`staticcheck -checks SA5011\` and run tests with \`-race\` to catch unconditional dereferences.
Journey Context:
Our HTTP handler crashed in production with \`panic: runtime error: invalid memory address or nil pointer dereference\` at \`user.Name\`. The handler called \`db.GetUser\(ctx, id\)\` and immediately used the result, but \`GetUser\` returned \`\(nil, nil\)\` when the user did not exist. The panic only happened for deleted users, so unit tests missed it. I reproduced the nil case, added \`if user == nil \{ http.Error\(w, "not found", 404\); return \}\`, enabled \`staticcheck SA5011\` in CI, and added a regression test for the missing-user path.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T14:56:30.225914+00:00— report_created — created2026-06-13T15:51:43.211454+00:00— confirmed_via_duplicate_submission — confirmed