[GH-ISSUE #5045] PUT "/api/accounts/{accountId}" returns 502 #10605

Open
opened 2026-08-05 01:26:35 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @hanspaerna on GitHub (Jan 6, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5045

Describe the problem

I intended to automate setting of network_range via REST API and prepared a PUT request with a following body:

{
    "settings": {
        "lazy_connection_enabled": false,
        "network_range": "100.116.0.0/16",
        "peer_inactivity_expiration": 600,
        "peer_inactivity_expiration_enabled": false,
        "peer_login_expiration": 86400,
        "peer_login_expiration_enabled": true,
        "regular_users_view_blocked": true
    }
}

To Reproduce

Steps to reproduce the behavior:

  1. Make a PUT request to /api/accounts/{accountId} with payload from above.
  2. See error

Expected behavior

Network range and other required values from request's body should change.

Are you using NetBird Cloud?

Self-hosted

NetBird version

0.61.2

Is any other VPN software installed?

No

Debug output

netbird-management logs:

2026/01/06 19:13:03 http: panic serving 10.44.0.1:36842: runtime error: invalid memory address or nil pointer dereference
goroutine 8447 [running]:
net/http.(*conn).serve.func1()
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:1947 +0xbe
panic({0x1ce1520?, 0x313a110?})
        /opt/hostedtoolcache/go/1.24.10/x64/src/runtime/panic.go:792 +0x132
github.com/netbirdio/netbird/management/server/store.(*SqlStore).ExecuteInTransaction.func1()
        /home/runner/work/netbird/netbird/management/server/store/sql_store.go:2908 +0x54
panic({0x1ce1520?, 0x313a110?})
        /opt/hostedtoolcache/go/1.24.10/x64/src/runtime/panic.go:792 +0x132
github.com/netbirdio/netbird/management/server.(*DefaultAccountManager).UpdateAccountSettings.func1({0x22dc800, 0xc000ad1200})
        /home/runner/work/netbird/netbird/management/server/account.go:336 +0x5d7
github.com/netbirdio/netbird/management/server/store.(*SqlStore).ExecuteInTransaction(0xc00049d2c0, {0x22b5a08, 0xc0003276b0}, 0xc00041acb0)
        /home/runner/work/netbird/netbird/management/server/store/sql_store.go:2933 +0x433
github.com/netbirdio/netbird/management/server.(*DefaultAccountManager).UpdateAccountSettings(0xc0001f1040, {0x22b5a08, 0xc0003276b0}, {0xc000849962, 0x14}, {0xc000849bc0, 0x24}, 0xc0004bb600)
        /home/runner/work/netbird/netbird/management/server/account.go:290 +0x2e8
github.com/netbirdio/netbird/management/server/http/handlers/accounts.(*handler).updateAccount(0xc000214920, {0x22b31b0, 0xc0006e8800}, 0xc0009d6000)
        /home/runner/work/netbird/netbird/management/server/http/handlers/accounts/accounts_handler.go:281 +0x7ea
net/http.HandlerFunc.ServeHTTP(0xc0004f1e40?, {0x22b31b0?, 0xc0006e8800?}, 0xc000368210?)
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29
github.com/netbirdio/netbird/management/server/http/middleware.(*AuthMiddleware).Handler-fm.(*AuthMiddleware).Handler.func1({0x22b31b0, 0xc0006e8800}, 0xc000788780)
        /home/runner/work/netbird/netbird/management/server/http/middleware/auth_middleware.go:108 +0x302
net/http.HandlerFunc.ServeHTTP(0xc0004ba6e0?, {0x22b31b0?, 0xc0006e8800?}, 0xc000788780?)
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29
github.com/rs/cors.(*Cors).Handler-fm.(*Cors).Handler.func1({0x22b31b0, 0xc0006e8800}, 0xc000788780)
        /home/runner/go/pkg/mod/github.com/rs/cors@v1.8.0/cors.go:219 +0x17e
net/http.HandlerFunc.ServeHTTP(0xc000788640?, {0x22b31b0?, 0xc0006e8800?}, 0x1?)
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29
github.com/netbirdio/netbird/management/server/telemetry.(*HTTPMiddleware).Handler-fm.(*HTTPMiddleware).Handler.func1({0x22b1a90, 0xc00096da40}, 0xc000788640)
        /home/runner/work/netbird/netbird/management/server/telemetry/http_api_metrics.go:186 +0x53b
net/http.HandlerFunc.ServeHTTP(0xc000788500?, {0x22b1a90?, 0xc00096da40?}, 0x40?)
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000fe840, {0x22b1a90, 0xc00096da40}, 0xc0007883c0)
        /home/runner/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1e2
github.com/netbirdio/netbird/management/internals/server.(*BaseServer).handlerFunc.func1({0x22b1a90, 0xc00096da40}, 0xc0007883c0)
        /home/runner/work/netbird/netbird/management/internals/server/server.go:264 +0x143
net/http.HandlerFunc.ServeHTTP(0xc00054ed20?, {0x22b1a90?, 0xc00096da40?}, 0x41cad4?)
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29
golang.org/x/net/http2/h2c.h2cHandler.ServeHTTP({{0x22a2da0?, 0xc00053dda0?}, 0xc0000a8cc0?}, {0x22b1a90, 0xc00096da40}, 0xc0007883c0)
        /home/runner/go/pkg/mod/golang.org/x/net@v0.47.0/http2/h2c/h2c.go:125 +0x673
net/http.serverHandler.ServeHTTP({0x22ab6d8?}, {0x22b1a90?, 0xc00096da40?}, 0x6?)
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:3301 +0x8e
net/http.(*conn).serve(0xc00097c510, {0x22b5a08, 0xc000326e10})
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2102 +0x625
created by net/http.(*Server).Serve in goroutine 66
        /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:3454 +0x485

Additional context

Netbird server runs in a single-node K3S cluster with Traefik, Gateway API and Crowdsec.

Have you tried these troubleshooting steps?

  • Reviewed client troubleshooting (if applicable)
  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
  • Restarted the NetBird client
  • Disabled other VPN software
  • Checked firewall settings
Originally created by @hanspaerna on GitHub (Jan 6, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5045 **Describe the problem** I intended to automate setting of network_range via REST API and prepared a PUT request with a following body: ``` { "settings": { "lazy_connection_enabled": false, "network_range": "100.116.0.0/16", "peer_inactivity_expiration": 600, "peer_inactivity_expiration_enabled": false, "peer_login_expiration": 86400, "peer_login_expiration_enabled": true, "regular_users_view_blocked": true } } ``` **To Reproduce** Steps to reproduce the behavior: 1. Make a PUT request to /api/accounts/{accountId} with payload from above. 2. See error **Expected behavior** Network range and other required values from request's body should change. **Are you using NetBird Cloud?** Self-hosted **NetBird version** `0.61.2` **Is any other VPN software installed?** No **Debug output** netbird-management logs: ``` 2026/01/06 19:13:03 http: panic serving 10.44.0.1:36842: runtime error: invalid memory address or nil pointer dereference goroutine 8447 [running]: net/http.(*conn).serve.func1() /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:1947 +0xbe panic({0x1ce1520?, 0x313a110?}) /opt/hostedtoolcache/go/1.24.10/x64/src/runtime/panic.go:792 +0x132 github.com/netbirdio/netbird/management/server/store.(*SqlStore).ExecuteInTransaction.func1() /home/runner/work/netbird/netbird/management/server/store/sql_store.go:2908 +0x54 panic({0x1ce1520?, 0x313a110?}) /opt/hostedtoolcache/go/1.24.10/x64/src/runtime/panic.go:792 +0x132 github.com/netbirdio/netbird/management/server.(*DefaultAccountManager).UpdateAccountSettings.func1({0x22dc800, 0xc000ad1200}) /home/runner/work/netbird/netbird/management/server/account.go:336 +0x5d7 github.com/netbirdio/netbird/management/server/store.(*SqlStore).ExecuteInTransaction(0xc00049d2c0, {0x22b5a08, 0xc0003276b0}, 0xc00041acb0) /home/runner/work/netbird/netbird/management/server/store/sql_store.go:2933 +0x433 github.com/netbirdio/netbird/management/server.(*DefaultAccountManager).UpdateAccountSettings(0xc0001f1040, {0x22b5a08, 0xc0003276b0}, {0xc000849962, 0x14}, {0xc000849bc0, 0x24}, 0xc0004bb600) /home/runner/work/netbird/netbird/management/server/account.go:290 +0x2e8 github.com/netbirdio/netbird/management/server/http/handlers/accounts.(*handler).updateAccount(0xc000214920, {0x22b31b0, 0xc0006e8800}, 0xc0009d6000) /home/runner/work/netbird/netbird/management/server/http/handlers/accounts/accounts_handler.go:281 +0x7ea net/http.HandlerFunc.ServeHTTP(0xc0004f1e40?, {0x22b31b0?, 0xc0006e8800?}, 0xc000368210?) /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29 github.com/netbirdio/netbird/management/server/http/middleware.(*AuthMiddleware).Handler-fm.(*AuthMiddleware).Handler.func1({0x22b31b0, 0xc0006e8800}, 0xc000788780) /home/runner/work/netbird/netbird/management/server/http/middleware/auth_middleware.go:108 +0x302 net/http.HandlerFunc.ServeHTTP(0xc0004ba6e0?, {0x22b31b0?, 0xc0006e8800?}, 0xc000788780?) /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29 github.com/rs/cors.(*Cors).Handler-fm.(*Cors).Handler.func1({0x22b31b0, 0xc0006e8800}, 0xc000788780) /home/runner/go/pkg/mod/github.com/rs/cors@v1.8.0/cors.go:219 +0x17e net/http.HandlerFunc.ServeHTTP(0xc000788640?, {0x22b31b0?, 0xc0006e8800?}, 0x1?) /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29 github.com/netbirdio/netbird/management/server/telemetry.(*HTTPMiddleware).Handler-fm.(*HTTPMiddleware).Handler.func1({0x22b1a90, 0xc00096da40}, 0xc000788640) /home/runner/work/netbird/netbird/management/server/telemetry/http_api_metrics.go:186 +0x53b net/http.HandlerFunc.ServeHTTP(0xc000788500?, {0x22b1a90?, 0xc00096da40?}, 0x40?) /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29 github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000fe840, {0x22b1a90, 0xc00096da40}, 0xc0007883c0) /home/runner/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1e2 github.com/netbirdio/netbird/management/internals/server.(*BaseServer).handlerFunc.func1({0x22b1a90, 0xc00096da40}, 0xc0007883c0) /home/runner/work/netbird/netbird/management/internals/server/server.go:264 +0x143 net/http.HandlerFunc.ServeHTTP(0xc00054ed20?, {0x22b1a90?, 0xc00096da40?}, 0x41cad4?) /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2294 +0x29 golang.org/x/net/http2/h2c.h2cHandler.ServeHTTP({{0x22a2da0?, 0xc00053dda0?}, 0xc0000a8cc0?}, {0x22b1a90, 0xc00096da40}, 0xc0007883c0) /home/runner/go/pkg/mod/golang.org/x/net@v0.47.0/http2/h2c/h2c.go:125 +0x673 net/http.serverHandler.ServeHTTP({0x22ab6d8?}, {0x22b1a90?, 0xc00096da40?}, 0x6?) /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:3301 +0x8e net/http.(*conn).serve(0xc00097c510, {0x22b5a08, 0xc000326e10}) /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:2102 +0x625 created by net/http.(*Server).Serve in goroutine 66 /opt/hostedtoolcache/go/1.24.10/x64/src/net/http/server.go:3454 +0x485 ``` **Additional context** Netbird server runs in a single-node K3S cluster with Traefik, Gateway API and Crowdsec. **Have you tried these troubleshooting steps?** - [x] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (if applicable) - [x] Checked for newer NetBird versions - [x] Searched for similar issues on GitHub (including closed ones) - [x] Restarted the NetBird client - [x] Disabled other VPN software - [x] Checked firewall settings
saavagebueno added the triage-needed label 2026-08-05 01:26:35 -04:00
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#10605