NB_SETUP_KEY environment variable takes precendence over a flag #2290

Open
opened 2025-11-20 07:07:10 -05:00 by saavagebueno · 2 comments
Owner

Originally created by @H3Cki on GitHub (Sep 18, 2025).

Describe the problem

Specifying a --setup-key flag doesn't override the NB_SETUP_KEY env var when running netbird up

To Reproduce

  1. Set NB_SETUP_KEY env var to a invalid value with a length of X characters.
  2. Use netbird up command with a --setup-key flag value that has Y characters or is just a valid setup key.
  3. Notice the error in the output that says the setup key has a length of X characters, indicating that it took the env var value instead of the value in the flag.

Expected behavior

Flag in the command should take precedence over an environment variable.

Are you using NetBird Cloud?

Yes, NetBird Cloud.

NetBird version

0.55.1 and 0.57.1 - happens on both those versions

Is any other VPN software installed?

No

Debug output

> export NB_SETUP_KEY=ABC
> netbird up --setup-key=CE4BFADE-CD61-4ADD-8E71-6A7BB76978F4
Error: daemon up failed: login failed: rpc error: code = InvalidArgument desc = invalid setup-key or no sso information provided, err: invalid UUID length: 3

Additional context

NixOS

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 @H3Cki on GitHub (Sep 18, 2025). **Describe the problem** Specifying a `--setup-key` flag doesn't override the `NB_SETUP_KEY` env var when running `netbird up` **To Reproduce** 1. Set `NB_SETUP_KEY` env var to a invalid value with a length of X characters. 2. Use `netbird up` command with a `--setup-key` flag value that has Y characters or is just a valid setup key. 3. Notice the error in the output that says the setup key has a length of X characters, indicating that it took the env var value instead of the value in the flag. **Expected behavior** Flag in the command should take precedence over an environment variable. **Are you using NetBird Cloud?** Yes, NetBird Cloud. **NetBird version** `0.55.1` and `0.57.1` - happens on both those versions **Is any other VPN software installed?** No **Debug output** ``` > export NB_SETUP_KEY=ABC > netbird up --setup-key=CE4BFADE-CD61-4ADD-8E71-6A7BB76978F4 Error: daemon up failed: login failed: rpc error: code = InvalidArgument desc = invalid setup-key or no sso information provided, err: invalid UUID length: 3 ``` **Additional context** NixOS **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 feature-requestwontfix labels 2025-11-20 07:07:10 -05:00
Author
Owner

@nazarewk commented on GitHub (Sep 18, 2025):

After consulting with the team. This is the way it worked since the very beginning and actually makes sense in some cases. We are reluctant to change the behavior right now, because users might actually depend on it in their setups.

I have changed it from bug to feature-request instead

@nazarewk commented on GitHub (Sep 18, 2025): After consulting with the team. This is the way it worked since the very beginning and actually makes sense in some cases. We are reluctant to change the behavior right now, because users might actually depend on it in their setups. I have changed it from `bug` to `feature-request` instead
Author
Owner

@mlsmaycon commented on GitHub (Sep 18, 2025):

Hello @H3Cki, thanks for reporting the issue.

This is the expected behavior. It works well for Docker deployments and is in place in many production systems across our users and customers.

We will document this to make it more visible to newcomers.

@mlsmaycon commented on GitHub (Sep 18, 2025): Hello @H3Cki, thanks for reporting the issue. This is the expected behavior. It works well for Docker deployments and is in place in many production systems across our users and customers. We will document this to make it more visible to newcomers.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2290