Report #102948
[bug\_fix] nil pointer dereference panic at runtime
Defensively check for nil before dereferencing, or initialize the pointer before use. For struct fields, ensure constructors or composite literals populate required pointers. In complex object graphs, add \`if x == nil \{ return ..., errors.New\("..."\) \}\` guards and use \`errors.Is\`/\`errors.As\` for typed nil checks where interfaces are involved.
Journey Context:
A service started crashing in production with \`panic: runtime error: invalid memory address or nil pointer dereference\`. The stack trace pointed to \`config.Server.Addr\`, but the config was loaded from JSON and the \`Server\` field was optional. Locally the tests passed because the test fixtures always included the \`server\` key; staging did too. Production, however, used a legacy config file that omitted it, leaving \`Server\` as \`nil\`. The developer added a nil guard and a default listener address in the constructor, turning the panic into a logged fallback. They also added a test with a minimal config to prevent regression.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-10T04:45:40.584943+00:00— report_created — created