Context
bee v2.8.1
Summary
After upgrading to the latest bee version v2.8.1 and restarting the node causes the node to crash with a panic error while attempting to connect to a peer.
Expected behavior
After the upgrade the node shall be able to connect to peers and gracefully handle connection errors.
Actual behavior
The node exits with a panic error with the following logs:
"time"="2026-07-08 08:44:10.117525" "level"="debug" "logger"="node/kademlia" "msg"="attempting connect to peer" "peer_address"="a689bea26fd351944906fe09b6a48aaf38ed069150ccf3211a0fdbcb0c4572f3"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x153a5ee]
goroutine 221926735 [running]:
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func1(0x3748b5b73960)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:431 +0x1ee
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func2(0x3748bbf0e070)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:492 +0x28d
created by github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler in goroutine 221925879
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:503 +0x1a9
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x153a5ee]
goroutine 221926737 [running]:
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func1(0x3748b5b739e0)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:431 +0x1ee
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func2(0x3748bbf0e070)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:492 +0x28d
created by github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler in goroutine 221925879
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:503 +0x1a9
Steps to reproduce
- Stop and upgrade a node from v2.8.0 to v2.8.1
- Restart the node and wait until it tries to connect to peers
- The node exits with a panic error after some time
Possible solution
Only a workaround: nuking the db and then restarting the node solves the problem.
AI Disclosure
Context
bee v2.8.1
Summary
After upgrading to the latest bee version v2.8.1 and restarting the node causes the node to crash with a panic error while attempting to connect to a peer.
Expected behavior
After the upgrade the node shall be able to connect to peers and gracefully handle connection errors.
Actual behavior
The node exits with a panic error with the following logs:
"time"="2026-07-08 08:44:10.117525" "level"="debug" "logger"="node/kademlia" "msg"="attempting connect to peer" "peer_address"="a689bea26fd351944906fe09b6a48aaf38ed069150ccf3211a0fdbcb0c4572f3"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x153a5ee]
goroutine 221926735 [running]:
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func1(0x3748b5b73960)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:431 +0x1ee
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func2(0x3748bbf0e070)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:492 +0x28d
created by github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler in goroutine 221925879
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:503 +0x1a9
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x153a5ee]
goroutine 221926737 [running]:
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func1(0x3748b5b739e0)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:431 +0x1ee
github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler.func2(0x3748bbf0e070)
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:492 +0x28d
created by github.com/ethersphere/bee/v2/pkg/topology/kademlia.(*Kad).connectionAttemptsHandler in goroutine 221925879
github.com/ethersphere/bee/v2/pkg/topology/kademlia/kademlia.go:503 +0x1a9
Steps to reproduce
Possible solution
Only a workaround: nuking the db and then restarting the node solves the problem.
AI Disclosure