netbirdio/netbird · error

setup config: %v

Error message

setup config: %v

What it means

Thrown by runInForegroundMode (client/cmd/up.go:219) when setupConfig(customDNSAddressConverted, cmd, configFilePath) fails. setupConfig assembles the input config from every flag before writing it: parsing --management-url and --admin-url, --remote-peers/--remote-networks ranges, pre-shared key handling, and other flag validation. Any malformed flag value aborts foreground startup.

Source

Thrown at client/cmd/up.go:219

	err := handleRebrand(cmd)
	if err != nil {
		return err
	}

	customDNSAddressConverted, err := parseCustomDNSAddress(cmd.Flag(dnsResolverAddress).Changed)
	if err != nil {
		return err
	}

	configFilePath, err := activeProf.FilePath()
	if err != nil {
		return fmt.Errorf("get active profile file path: %v", err)
	}

	ic, err := setupConfig(customDNSAddressConverted, cmd, configFilePath)
	if err != nil {
		return fmt.Errorf("setup config: %v", err)
	}

	providedSetupKey, err := getSetupKey()
	if err != nil {
		return err
	}

	config, err := profilemanager.UpdateOrCreateConfig(*ic)
	if err != nil {
		return fmt.Errorf("get config file: %v", err)
	}

	_, _ = profilemanager.UpdateOldManagementURL(ctx, config, configFilePath)

	// Restore residual state left by a previous run that did not shut down
	// cleanly, mirroring what the daemon does before connecting: it recovers
	// DNS config (a stale resolv.conf takeover can make the management
	// hostname unresolvable), firewall rules, ssh config and legacy routing.

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Re-run with a fully qualified management URL, e.g. --management-url https://api.example.net:443
  2. Remove recently added flags one by one to find the rejected value; compare with 'netbird up --help'
  3. Run 'netbird up' (daemon mode) once with the same flags - it surfaces the same validation with more context in some paths
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.Parse(managementURL)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
    log.Fatalf("--management-url must be a full URL like https://api.example.net:443, got %q", managementURL)
}

Prevention

When it happens

Trigger: 'netbird up --foreground-mode --management-url bad-url' (missing scheme/host), an unparseable admin URL, invalid values among the many boolean/path flags setupConfig reads, or flag combinations unsupported in foreground mode.

Common situations: On-prem users pasting the wrong management URL (missing https:// or port); wrapper scripts passing stale flag names; foreground runs in containers with templated URLs that render empty.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/778281fe630bc600. Report an issue: GitHub.