{"record":{"id":"4427b34ac7900e8d","repo":"netbirdio/netbird","slug":"connection-to-daemon-closed-unexpectedly","errorCode":null,"errorMessage":"connection to daemon closed unexpectedly","messagePattern":"connection to daemon closed unexpectedly","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/expose.go","lineNumber":282,"sourceCode":"\t}\n\tif r.PortAutoAssigned && exposeExternalPort != 0 {\n\t\tcmd.Printf(\"\\n  Note: requested port %d was reassigned\\n\", exposeExternalPort)\n\t}\n\tcmd.Println()\n\tcmd.Println(\"Press Ctrl+C to stop exposing.\")\n}\n\nfunc waitForExposeEvents(cmd *cobra.Command, ctx context.Context, stream proto.DaemonService_ExposeServiceClient) error {\n\tfor {\n\t\t_, err := stream.Recv()\n\t\tif err != nil {\n\t\t\tif ctx.Err() != nil {\n\t\t\t\tcmd.Println(\"\\nService stopped.\")\n\t\t\t\t//nolint:nilerr\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif errors.Is(err, io.EOF) {\n\t\t\t\treturn fmt.Errorf(\"connection to daemon closed unexpectedly\")\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"stream error: %w\", err)\n\t\t}\n\t}\n}\n","sourceCodeStart":264,"sourceCodeEnd":288,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/expose.go#L264-L288","documentation":"Error \"connection to daemon closed unexpectedly\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/cmd/expose.go:282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}