Skip to content

Redistribution handler panics when called with storage incentives disabled #5143

@Cafe137

Description

@Cafe137

Context

2.6.0-rc7-027599b3a
storage-incentives-enable: false
curl "http://localhost:1633/redistributionstate"

Expected behavior

Would prefer a HTTP 4xx stating that this feature is disabled

Actual behavior

"time"="2025-07-02 14:44:29.243619" "level"="error" "logger"="node" "msg"="http: panic serving 127.0.0.1:56707: runtime error: invalid memory address or nil pointer dereference
    goroutine 1351823 [running]:
    net/http.(*conn).serve.func1()
    \tnet/http/server.go:1947 +0xb0
    panic({0x101e12e60?, 0x1030826d0?})
    \truntime/panic.go:792 +0x124
    github.com/ethersphere/bee/v2/pkg/storageincentives.(*Agent).Status(...)
    \tgithub.com/ethersphere/bee/v2/pkg/storageincentives/agent.go:556
    github.com/ethersphere/bee/v2/pkg/api.(*Service).redistributionStatusHandler(0x140005e0388, {0x10203dc50, 0x1400476fd10}, 0x14000c64140)
    \tgithub.com/ethersphere/bee/v2/pkg/api/redistribution.go:41 +0xbc
    net/http.HandlerFunc.ServeHTTP(0x1400daf33b8?, {0x10203dc50?, 0x1400476fd10?}, 0x12a0ed078?)
    \tnet/http/server.go:2294 +0x38
    github.com/ethersphere/bee/v2/pkg/jsonhttp.HandleMethods(0x14001eb2ed0, {0x101848f3b, 0x2b}, {0x10182fe47, 0x1f}, {0x10203dc50, 0x1400476fd10}, 0x14000c64140)
    \tgithub.com/ethersphere/bee/v2/pkg/jsonhttp/handlers.go:25 +0xe4
    github.com/ethersphere/bee/v2/pkg/jsonhttp.MethodHandler.ServeHTTP(0x102040d58?, {0x10203dc50?, 0x1400476fd10?}, 0x101c81548?)
    \tgithub.com/ethersphere/bee/v2/pkg/jsonhttp/handlers.go:17 +0x50
    github.com/ethersphere/bee/v2/pkg/api.(*Service).mountBusinessDebug.(*Service).mountBusinessDebug.func1.(*Service).checkRouteAvailability.func81({0x10203dc50?, 0x1400476fd10?}, 0x95?)
    \tgithub.com/ethersphere/bee/v2/pkg/api/router.go:187 +0x4c
    net/http.HandlerFunc.ServeHTTP(0x14000c64000?, {0x10203dc50?, 0x1400476fd10?}, 0x100aeab0a?)
    \tnet/http/server.go:2294 +0x38
    github.com/gorilla/mux.(*Router).ServeHTTP(0x140005c8900, {0x10203dc50, 0x1400476fd10}, 0x1400035fb80)
    \tgithub.com/gorilla/[email protected]/mux.go:210 +0x194
    github.com/ethersphere/bee/v2/pkg/api.(*Service).corsHandler.func1({0x10203dc50, 0x1400476fd10}, 0x1400035fb80)
    \tgithub.com/ethersphere/bee/v2/pkg/api/api.go:597 +0x414
    net/http.HandlerFunc.ServeHTTP(0x1400daf37c8?, {0x10203dc50?, 0x1400476fd10?}, 0x1016ab368?)
    \tnet/http/server.go:2294 +0x38
    github.com/ethersphere/bee/v2/pkg/api.(*Service).pageviewMetricsHandler-fm.(*Service).pageviewMetricsHandler.func1({0x10203dc50, 0x1400476fd10}, 0x1400035fb80)
    \tgithub.com/ethersphere/bee/v2/pkg/api/metrics.go:113 +0x80
    net/http.HandlerFunc.ServeHTTP(0x10203dcb0?, {0x10203dc50?, 0x1400476fd10?}, 0x100b35d74?)
    \tnet/http/server.go:2294 +0x38
    github.com/ethersphere/bee/v2/pkg/api.(*Service).responseCodeMetricsHandler-fm.(*Service).responseCodeMetricsHandler.func1({0x10203dcb0?, 0x14000dfd8a0?}, 0x1400035fb80)
    \tgithub.com/ethersphere/bee/v2/pkg/api/metrics.go:121 +0x6c
    net/http.HandlerFunc.ServeHTTP(0x0?, {0x10203dcb0?, 0x14000dfd8a0?}, 0x100b6a2d8?)
    \tnet/http/server.go:2294 +0x38
    github.com/ethersphere/bee/v2/pkg/api.(*Service).EnableFullAPI.func1.1.CompressHandler.CompressHandlerLevel.1({0x10203dcb0, 0x14000dfd8a0}, 0x1400035fb80)
    \tgithub.com/gorilla/[email protected]/compress.go:148 +0x240
    net/http.HandlerFunc.ServeHTTP(...)
    \tnet/http/server.go:2294
    github.com/ethersphere/bee/v2/pkg/api.(*Service).EnableFullAPI.func1.1({0x10203dcb0?, 0x14000dfd8a0?}, 0x1400035fb80?)
    \tgithub.com/ethersphere/bee/v2/pkg/api/router.go:93 +0xf0
    net/http.HandlerFunc.ServeHTTP(0xe0?, {0x10203dcb0?, 0x14000dfd8a0?}, 0x0?)
    \tnet/http/server.go:2294 +0x38
    github.com/ethersphere/bee/v2/pkg/api.(*Service).EnableFullAPI.NewHTTPAccessLogHandler.func2.1({0x10203db60?, 0x1400a9167e0?}, 0x1400035fb80)
    \tgithub.com/ethersphere/bee/v2/pkg/log/httpaccess/http_access.go:41 +0xf0
    net/http.HandlerFunc.ServeHTTP(0x1400daf3b78?, {0x10203db60?, 0x1400a9167e0?}, 0x100ec21b4?)
    \tnet/http/server.go:2294 +0x38
    net/http.serverHandler.ServeHTTP({0x14009da86f0?}, {0x10203db60?, 0x1400a9167e0?}, 0x1?)
    \tnet/http/server.go:3301 +0xbc
    net/http.(*conn).serve(0x1400c3b0c60, {0x102040d58, 0x140003fdaa0})
    \tnet/http/server.go:2102 +0x52c
    created by net/http.(*Server).Serve in goroutine 105
    \tnet/http/server.go:3454 +0x3d8
    "

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagingnew issues that need triaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions