{"record":{"id":"f0aa777ca2f89c27","repo":"netbirdio/netbird","slug":"create-ssh-proxy-w","errorCode":null,"errorMessage":"create SSH proxy: %w","messagePattern":"create SSH proxy: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/ssh.go","lineNumber":836,"sourceCode":"\thost := args[0]\n\tportStr := args[1]\n\n\tport, err := strconv.Atoi(portStr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid port: %s\", portStr)\n\t}\n\n\t// Check env var for browser setting since this command is invoked via SSH ProxyCommand\n\t// where command-line flags cannot be passed. Default is to open browser.\n\tnoBrowser := getBoolEnvOrDefault(\"NO_BROWSER\", false)\n\tvar browserOpener func(string) error\n\tif !noBrowser {\n\t\tbrowserOpener = util.OpenBrowser\n\t}\n\n\tproxy, err := sshproxy.New(daemonAddr, host, port, cmd.ErrOrStderr(), browserOpener)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create SSH proxy: %w\", err)\n\t}\n\tdefer func() {\n\t\tif err := proxy.Close(); err != nil {\n\t\t\tlog.Debugf(\"close SSH proxy: %v\", err)\n\t\t}\n\t}()\n\n\tif err := proxy.Connect(cmd.Context()); err != nil {\n\t\treturn fmt.Errorf(\"SSH proxy: %w\", err)\n\t}\n\n\treturn nil\n}\n\nvar sshDetectCmd = &cobra.Command{\n\tUse:    \"detect <host> <port>\",\n\tShort:  \"Detect if a host is running NetBird SSH\",\n\tLong:   \"Internal command used by SSH Match exec to detect NetBird SSH servers. Exit codes: 0=JWT, 1=no-JWT, 2=regular SSH\",","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/ssh.go#L818-L854","documentation":"sshproxy.New builds a gRPC client to the NetBird daemon using daemonaddr.DialTarget(daemonAddr) and grpc.NewClient. Because NewClient is lazy (non-blocking), this error almost always means the daemon address itself is invalid or cannot be turned into a dial target, not that the daemon is unreachable — connectivity problems surface later in Connect(). The underlying error is wrapped by sshproxy.New as 'connect to daemon: ...' and again here as 'create SSH proxy: ...'.","triggerScenarios":"NB_DAEMON_ADDR env var or --daemon-addr flag set to a malformed target: missing scheme on a unix path, bad characters, empty string after shell expansion, or a URL that fails target parsing on this platform.","commonSituations":"Pointing the CLI at a custom daemon socket (NB_DAEMON_ADDR=unix:///var/run/netbird.sock) with a typo; environments where the env var leaks a Windows-style pipe name into a Linux session; version changes in the accepted address formats.","solutions":["Check NB_DAEMON_ADDR / --daemon-addr and use the documented form, e.g. unix:///var/run/netbird.sock (Unix) or the named pipe form on Windows","Unset NB_DAEMON_ADDR to use the default daemon address","Run `netbird status` with the same env to confirm the address is dialable at all","Print the resolved daemonAddr before invoking ssh-proxy to catch empty or mangled values"],"exampleFix":"# before\nexport NB_DAEMON_ADDR=/var/run/netbird.sock   # missing unix:// scheme may fail target parsing\n\n# after\nexport NB_DAEMON_ADDR=unix:///var/run/netbird.sock","handlingStrategy":"validation","validationCode":"// fail fast on a malformed daemon address before sshproxy.New\nif daemonAddr == \"\" {\n    return fmt.Errorf(\"daemon address is empty\")\n}\nif _, _, err := daemonaddr.DialTarget(daemonAddr); err != nil { // or equivalent parse\n    return fmt.Errorf(\"invalid daemon address %q: %w\", daemonAddr, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin NB_DAEMON_ADDR in one shared script instead of ad-hoc exports","Use the documented target forms (unix:///path/to.sock) and assert the socket file exists","Smoke-test custom daemon addresses with `netbird status` before using ssh"],"tags":["go","grpc","cli","ssh","daemon","configuration"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}