{"record":{"id":"9aa38712af39a9f1","repo":"netbirdio/netbird","slug":"parse-custom-dns-address-v","errorCode":null,"errorMessage":"parse custom DNS address: %v","messagePattern":"parse custom DNS address: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/up.go","lineNumber":278,"sourceCode":"\n\tr := peer.NewRecorder(config.ManagementURL.String())\n\tr.GetFullStatus()\n\n\tconnectClient := internal.NewConnectClient(ctx, config, r)\n\tSetupDebugHandler(ctx, config, r, connectClient, \"\")\n\n\treturn connectClient.Run(nil, util.FindFirstLogPath(logFiles))\n}\n\nfunc runInDaemonMode(ctx context.Context, cmd *cobra.Command, pm *profilemanager.ProfileManager, activeProf *profilemanager.Profile, profileSwitched bool) error {\n\t// Check if deprecated config flag is set and show warning\n\tif cmd.Flag(\"config\").Changed && configPath != \"\" {\n\t\tcmd.PrintErrf(\"Warning: Config flag is deprecated on up command, it should be set as a service argument with $NB_CONFIG environment or with \\\"-config\\\" flag; netbird service reconfigure --service-env=\\\"NB_CONFIG=<file_path>\\\" or netbird service run --config=<file_path>\\n\")\n\t}\n\n\tcustomDNSAddressConverted, err := parseCustomDNSAddress(cmd.Flag(dnsResolverAddress).Changed)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse custom DNS address: %v\", err)\n\t}\n\n\tconn, err := DialClientGRPCServer(ctx, daemonAddr)\n\tif err != nil {\n\t\t//nolint\n\t\treturn fmt.Errorf(\"failed to connect to daemon error: %v\\n\"+\n\t\t\t\"If the daemon is not running please run: \"+\n\t\t\t\"\\nnetbird service install \\nnetbird service start\\n\", err)\n\t}\n\tdefer func() {\n\t\terr := conn.Close()\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"failed closing daemon gRPC client connection %v\", err)\n\t\t\treturn\n\t\t}\n\t}()\n\n\tclient := proto.NewDaemonServiceClient(conn)","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L260-L296","documentation":"Thrown by the `netbird up` command before any daemon contact, when the --dns-resolver-address flag cannot be parsed. runInDaemonMode calls parseCustomDNSAddress, which only accepts a literal \"IP:Port\" string or an empty string, and this wrapper adds the 'parse custom DNS address' context. It is pure CLI-side input validation, so the daemon is never reached when it fires.","triggerScenarios":"Running `netbird up --dns-resolver-address <value>` where value is neither empty nor parseable by netip.ParseAddrPort (e.g. \"8.8.8.8\", \"localhost:53\", \"1.2.3.4:99999\"). Only fires when the flag was explicitly changed on this invocation.","commonSituations":"Users porting an old config that used a bare IP without a port, using a hostname instead of an IP, or adding a port outside 0-65535. Also seen after upgrades that changed this flag from host:port tolerant to strict IP:Port.","solutions":["Pass a strict IP:Port value, e.g. `netbird up --dns-resolver-address 8.8.8.8:53`","Pass an explicit empty string (`--dns-resolver-address \"\"`) to reset to the daemon default","Drop the flag entirely to keep the current profile setting"],"exampleFix":"// before\nnetbird up --dns-resolver-address 8.8.8.8\n// after\nnetbird up --dns-resolver-address 8.8.8.8:53","handlingStrategy":"validation","validationCode":"// before invoking `netbird up`, gate on the same rule the CLI applies\nif dnsResolverAddress != \"\" {\n\tif _, err := netip.ParseAddrPort(dnsResolverAddress); err != nil {\n\t\treturn fmt.Errorf(\"--dns-resolver-address must be IP:Port, got %q\", dnsResolverAddress)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write the flag as literal IP:Port (8.8.8.8:53); never a hostname or bare IP","Use \"\" explicitly to reset instead of guessing sentinel values","Script-side, validate with netip.ParseAddrPort before shelling out"],"tags":["go","cli","netbird","dns","validation","flag-parsing"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}