[PR #6749] [client] stop retrying invalid setup keys #29861

Open
opened 2026-08-05 08:09:11 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6749
Author: @CoderSufiyan
Created: 7/13/2026
Status: 🔄 Open

Base: mainHead: fix/issue-5715-invalid-setup-key


📝 Commits (2)

  • f446bbc [client] stop retrying invalid setup keys
  • e02da9b [client] treat unauthenticated login errors as permanent

📊 Changes

2 files changed (+64 additions, -4 deletions)

View changed files

📝 client/internal/auth/auth.go (+7 -4)
📝 client/internal/auth/auth_test.go (+57 -0)

📄 Description

Problem
netbird up --setup-key can hang in the daemon retry loop when management returns a permanent auth/setup-key error such as NotFound for an invalid setup key. The retry loop already treated some auth failures as permanent, but not all relevant management auth statuses.

Solution
Classify NotFound and Unauthenticated as permanent authentication/setup-key errors. This lets invalid setup keys and unusable credentials fail fast while keeping connection errors like DeadlineExceeded and Unavailable retryable.

Documentation

  • Documentation is not needed

This only changes retry classification for an existing error path.

Test
go test ./client/internal/auth ./client/server

Fixes #5715

Summary by CodeRabbit

  • Bug Fixes
    • Improved authentication error handling during login by expanding which authentication-related responses stop retrying, including “not found” and other common auth/status failures.
  • Tests
    • Added unit test coverage to verify authentication error classification across expected gRPC status codes and non-gRPC errors.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6749 **Author:** [@CoderSufiyan](https://github.com/CoderSufiyan) **Created:** 7/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/issue-5715-invalid-setup-key` --- ### 📝 Commits (2) - [`f446bbc`](https://github.com/netbirdio/netbird/commit/f446bbc53f67084fe561b71850ade70dc448d8ab) [client] stop retrying invalid setup keys - [`e02da9b`](https://github.com/netbirdio/netbird/commit/e02da9b309f28f8fe04071b0a346ac125c0bcdb9) [client] treat unauthenticated login errors as permanent ### 📊 Changes **2 files changed** (+64 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/auth/auth.go` (+7 -4) 📝 `client/internal/auth/auth_test.go` (+57 -0) </details> ### 📄 Description **Problem** `netbird up --setup-key` can hang in the daemon retry loop when management returns a permanent auth/setup-key error such as `NotFound` for an invalid setup key. The retry loop already treated some auth failures as permanent, but not all relevant management auth statuses. **Solution** Classify `NotFound` and `Unauthenticated` as permanent authentication/setup-key errors. This lets invalid setup keys and unusable credentials fail fast while keeping connection errors like `DeadlineExceeded` and `Unavailable` retryable. **Documentation** - [x] Documentation is **not needed** This only changes retry classification for an existing error path. **Test** `go test ./client/internal/auth ./client/server` Fixes #5715 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved authentication error handling during login by expanding which authentication-related responses stop retrying, including “not found” and other common auth/status failures. * **Tests** * Added unit test coverage to verify authentication error classification across expected gRPC status codes and non-gRPC errors. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:09:11 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#29861