{"record":{"id":"778281fe630bc600","repo":"netbirdio/netbird","slug":"setup-config-v","errorCode":null,"errorMessage":"setup config: %v","messagePattern":"setup config: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/up.go","lineNumber":219,"sourceCode":"\n\terr := handleRebrand(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcustomDNSAddressConverted, err := parseCustomDNSAddress(cmd.Flag(dnsResolverAddress).Changed)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfigFilePath, err := activeProf.FilePath()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get active profile file path: %v\", err)\n\t}\n\n\tic, err := setupConfig(customDNSAddressConverted, cmd, configFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"setup config: %v\", err)\n\t}\n\n\tprovidedSetupKey, err := getSetupKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfig, err := profilemanager.UpdateOrCreateConfig(*ic)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get config file: %v\", err)\n\t}\n\n\t_, _ = profilemanager.UpdateOldManagementURL(ctx, config, configFilePath)\n\n\t// Restore residual state left by a previous run that did not shut down\n\t// cleanly, mirroring what the daemon does before connecting: it recovers\n\t// DNS config (a stale resolv.conf takeover can make the management\n\t// hostname unresolvable), firewall rules, ssh config and legacy routing.","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L201-L237","documentation":"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.","triggerScenarios":"'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.","commonSituations":"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.","solutions":["Re-run with a fully qualified management URL, e.g. --management-url https://api.example.net:443","Remove recently added flags one by one to find the rejected value; compare with 'netbird up --help'","Run 'netbird up' (daemon mode) once with the same flags - it surfaces the same validation with more context in some paths"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"u, err := url.Parse(managementURL)\nif err != nil || (u.Scheme != \"http\" && u.Scheme != \"https\") || u.Host == \"\" {\n    log.Fatalf(\"--management-url must be a full URL like https://api.example.net:443, got %q\", managementURL)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass scheme + host (+ port for on-prem) in management URLs","Dry-run flag-heavy commands and bisect newly added flags on failure"],"tags":["cli","foreground","validation","flags","netbird"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}