[GH-ISSUE #6007] Netbird server tries to create a targets record with null in non-nullable column. #11997

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

Originally created by @aljazs-implex on GitHub (Apr 27, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/6007

Describe the problem

Netbird-server seems to be trying to create a record in the database that has a non-nullable value set to null.

To Reproduce

Steps to reproduce the behavior:
0. Run currenty latest (see versions bellow) netbird stack with postgresql

  1. Go to /reverse-proxy/services
  2. Click on "Add service"
  3. Fill in basic details
  4. attempt to create the service
  5. See error in netbird-server and postgres container logs

Expected behavior

I expect to have the database record created and the proxy service handled.

Are you using NetBird Cloud?

No I am using a self hosted version, spun up two days ago from scratch.

NetBird version

Management v0.70.0
Dashboard v2.37.1

Debug output

netbird-server  | 2026-04-27T20:38:24.167Z ERRO [context: HTTP, requestID: d7nsig422o1c73da33j0, accountID: ANONymizedAccountID, userID: ANONymizedUserID] management/server/store/sql_store.go:4896: failed to create service to store: ERROR: null value in column "id" of relation "targets" violates not-null constraint (SQLSTATE 23502)
netbird-server  | 2026-04-27T20:38:24.167Z ERRO [context: HTTP, requestID: d7nsig422o1c73da33j0, accountID: ANONymizedAccountID, userID: ANONymizedUserID] shared/management/http/util/util.go:85: got a handler error: create service: failed to create service to store
netbird-server  | 2026-04-27T20:38:24.167Z ERRO [context: HTTP, requestID: d7nsig422o1c73da33j0, accountID: ANONymizedAccountID, userID: ANONymizedUserID] management/server/telemetry/http_api_metrics.go:204: HTTP response d7nsig422o1c73da33j0: POST /api/reverse-proxies/services status 500
postgres-1  | 2026-04-27 20:38:24.167 UTC [90516] ERROR:  null value in column "id" of relation "targets" violates not-null constraint
postgres-1  | 2026-04-27 20:38:24.167 UTC [90516] DETAIL:  Failing row contains (null, ANONymizedAccountID, d7nsig422o1c73da33jg, null, , 8000, http, ANONymizedTargetID, peer, t, f, 0, 0, , null, f).
postgres-1  | 2026-04-27 20:38:24.167 UTC [90516] STATEMENT:  INSERT INTO "targets" ("account_id","service_id","path","host","port","protocol","target_id","target_type","enabled","skip_tls_verify","request_timeout","session_idle_timeout","path_rewrite","custom_headers","proxy_protocol") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) ON CONFLICT ("id") DO UPDATE SET "service_id"="excluded"."service_id" RETURNING "id"

Values ANONymizedAccountID, ANONymizedUserID, ANONymizedTargetID were manually replaced.

Have you tried these troubleshooting steps?

  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
Originally created by @aljazs-implex on GitHub (Apr 27, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/6007 **Describe the problem** Netbird-server seems to be trying to create a record in the database that has a non-nullable value set to `null`. **To Reproduce** Steps to reproduce the behavior: 0. Run currenty latest (see versions bellow) netbird stack with postgresql 1. Go to `/reverse-proxy/services` 2. Click on "Add service" 3. Fill in basic details 4. attempt to create the service 5. See error in netbird-server and postgres container logs **Expected behavior** I expect to have the database record created and the proxy service handled. **Are you using NetBird Cloud?** No I am using a self hosted version, spun up two days ago from scratch. **NetBird version** ``` Management v0.70.0 Dashboard v2.37.1 ``` **Debug output** ``` netbird-server | 2026-04-27T20:38:24.167Z ERRO [context: HTTP, requestID: d7nsig422o1c73da33j0, accountID: ANONymizedAccountID, userID: ANONymizedUserID] management/server/store/sql_store.go:4896: failed to create service to store: ERROR: null value in column "id" of relation "targets" violates not-null constraint (SQLSTATE 23502) netbird-server | 2026-04-27T20:38:24.167Z ERRO [context: HTTP, requestID: d7nsig422o1c73da33j0, accountID: ANONymizedAccountID, userID: ANONymizedUserID] shared/management/http/util/util.go:85: got a handler error: create service: failed to create service to store netbird-server | 2026-04-27T20:38:24.167Z ERRO [context: HTTP, requestID: d7nsig422o1c73da33j0, accountID: ANONymizedAccountID, userID: ANONymizedUserID] management/server/telemetry/http_api_metrics.go:204: HTTP response d7nsig422o1c73da33j0: POST /api/reverse-proxies/services status 500 ``` ``` postgres-1 | 2026-04-27 20:38:24.167 UTC [90516] ERROR: null value in column "id" of relation "targets" violates not-null constraint postgres-1 | 2026-04-27 20:38:24.167 UTC [90516] DETAIL: Failing row contains (null, ANONymizedAccountID, d7nsig422o1c73da33jg, null, , 8000, http, ANONymizedTargetID, peer, t, f, 0, 0, , null, f). postgres-1 | 2026-04-27 20:38:24.167 UTC [90516] STATEMENT: INSERT INTO "targets" ("account_id","service_id","path","host","port","protocol","target_id","target_type","enabled","skip_tls_verify","request_timeout","session_idle_timeout","path_rewrite","custom_headers","proxy_protocol") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) ON CONFLICT ("id") DO UPDATE SET "service_id"="excluded"."service_id" RETURNING "id" ``` Values `ANONymizedAccountID`, `ANONymizedUserID`, `ANONymizedTargetID` were manually replaced. **Have you tried these troubleshooting steps?** - [x] Checked for newer NetBird versions - [x] Searched for similar issues on GitHub (including closed ones)
saavagebueno added the triage-needed label 2026-08-05 01:32:02 -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#11997