Skip to content

Conversation

@kimeuichan
Copy link
Contributor

Problem

Running go run main.go debug causes a nil pointer dereference panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102bc7b60]

goroutine 1 [running]:
log.(*Logger).output(...)
/path/to/go/src/log/log.go:203 +0x30
log.(*Logger).Printf(...)
/path/to/go/src/log/log.go:268 +0x5c
claude-squad/config.LoadConfig()
/path/to/claude-squad/config/config.go:139 +0x240

Root Cause

  • The debug command calls config.LoadConfig()
  • LoadConfig() tries to use log.ErrorLog.Printf()
  • However, log.ErrorLog is nil because log.Initialize() hasn't been called yet

Solution

  • Add log.Initialize(false) at the beginning of debugCmd's RunE function
  • Add defer log.Close() to ensure proper resource cleanup

Testing

  • Verified go run main.go debug works correctly
  • Verified built binary also works correctly

@github-actions
Copy link

github-actions bot commented Aug 7, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@kimeuichan
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@mufeez-amjad
Copy link
Member

thanks for the fix!

@mufeez-amjad mufeez-amjad merged commit cb057c0 into smtg-ai:main Aug 9, 2025
7 of 8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 9, 2025
@kimeuichan kimeuichan deleted the feat/defer-log-init branch August 10, 2025 04:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants