Summary
arkd panics with a nil pointer dereference in scheduleSweepBatchOutput when nbxplorer temporarily loses access to its database (e.g. during DB maintenance/migration).
Panic trace
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x9352de]
goroutine 3973311 [running]:
github.com/arkade-os/arkd/internal/core/application.(*service).scheduleSweepBatchOutput(0x182fad9fa788, 0x182fb016d600)
/app/internal/core/application/service.go:3480 +0x17e
created by github.com/arkade-os/arkd/internal/core/application.(*service).registerEvent
Root cause
scheduleSweepBatchOutput is a background goroutine that interacts with nbxplorer. When nbxplorer loses its DB connection (e.g. during a maintenance window or rolling restart), it returns an error or nil response that scheduleSweepBatchOutput does not guard against, resulting in a nil pointer dereference and a full arkd crash.
Impact
arkd process exits and must restart (VTXO restore watch required, ~14 min downtime observed on 2026-04-22)
- Any in-progress rounds are aborted
Expected behaviour
scheduleSweepBatchOutput (and background goroutines in general) should recover from transient nbxplorer errors gracefully — log the error, skip or retry the sweep, and continue running rather than crashing the entire process.
Fix direction
- Add nil checks / error guards before dereferencing return values from nbxplorer calls in
service.go:3480
- Consider a
recover() in the goroutine spawned by registerEvent as a safety net
- Optionally: retry logic with backoff for transient nbxplorer unavailability
Context
Discovered during DB maintenance on 2026-04-22. nbxplorer's DB migration caused a brief connection blip; arkd's auto-unlocker triggered a wallet lock/unlock round-trip which hit this code path.
Summary
arkdpanics with a nil pointer dereference inscheduleSweepBatchOutputwhennbxplorertemporarily loses access to its database (e.g. during DB maintenance/migration).Panic trace
Root cause
scheduleSweepBatchOutputis a background goroutine that interacts with nbxplorer. When nbxplorer loses its DB connection (e.g. during a maintenance window or rolling restart), it returns an error or nil response thatscheduleSweepBatchOutputdoes not guard against, resulting in a nil pointer dereference and a fullarkdcrash.Impact
arkdprocess exits and must restart (VTXO restore watch required, ~14 min downtime observed on 2026-04-22)Expected behaviour
scheduleSweepBatchOutput(and background goroutines in general) should recover from transient nbxplorer errors gracefully — log the error, skip or retry the sweep, and continue running rather than crashing the entire process.Fix direction
service.go:3480recover()in the goroutine spawned byregisterEventas a safety netContext
Discovered during DB maintenance on 2026-04-22. nbxplorer's DB migration caused a brief connection blip; arkd's auto-unlocker triggered a wallet lock/unlock round-trip which hit this code path.