{"record":{"id":"e45f963228775a29","repo":"docker/cli","slug":"failed-to-open-the-raw-stream-connection-w","errorCode":null,"errorMessage":"failed to open the raw stream connection: %w","messagePattern":"failed to open the raw stream connection: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/system/dial_stdio.go","lineNumber":39,"sourceCode":"\t\tArgs:   cli.NoArgs,\n\t\tHidden: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn runDialStdio(cmd.Context(), dockerCLI)\n\t\t},\n\t\tValidArgsFunction:     cobra.NoFileCompletions,\n\t\tDisableFlagsInUseLine: true,\n\t}\n\treturn cmd\n}\n\nfunc runDialStdio(ctx context.Context, dockerCli command.Cli) error {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tdialer := dockerCli.Client().Dialer()\n\tconn, err := dialer(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open the raw stream connection: %w\", err)\n\t}\n\tdefer conn.Close()\n\n\tvar connHalfCloser halfCloser\n\tswitch t := conn.(type) {\n\tcase halfCloser:\n\t\tconnHalfCloser = t\n\tcase halfReadWriteCloser:\n\t\tconnHalfCloser = &nopCloseReader{t}\n\tdefault:\n\t\treturn errors.New(\"the raw stream connection does not implement halfCloser\")\n\t}\n\n\tstdin2conn := make(chan error, 1)\n\tconn2stdout := make(chan error, 1)\n\tgo func() {\n\t\tstdin2conn <- copier(connHalfCloser, &halfReadCloserWrapper{os.Stdin}, \"stdin to stream\")\n\t}()","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/system/dial_stdio.go#L21-L57","documentation":"Returned by the hidden 'docker system dial-stdio' command when the daemon Dialer() fails to establish a raw stream connection. dial-stdio proxies stdio to the daemon socket and is invoked internally (e.g. by Docker Desktop), not manually.","triggerScenarios":"The Dialer closure returned by the client cannot connect to DOCKER_HOST (socket missing, TCP unreachable, TLS handshake failure, permission denied on the unix socket). Triggered at dial_stdio.go:37-39.","commonSituations":"Daemon not running; DOCKER_HOST points at a stale/unreachable socket; socket file permissions; Docker Desktop VM not started; TLS misconfiguration for tcp:// endpoints.","solutions":["Verify the daemon is up: 'docker version' / 'systemctl status docker'.","Check DOCKER_HOST and the active context resolve to a live socket.","Ensure the user can read the socket (docker group) or use sudo/context appropriately."],"exampleFix":"# before: dial-stdio cannot reach the socket\ndocker system dial-stdio\n\n# after: confirm daemon + socket then retry\nsystemctl status docker\nls -l /var/run/docker.sock\ndocker version  # sanity check","handlingStrategy":"validation","validationCode":"// Confirm the daemon socket is reachable before dialing\nif _, err := apiClient.Ping(ctx); err != nil {\n    return fmt.Errorf(\"daemon unreachable: %w\", err)\n}","typeGuard":"func dialerReachable(ctx context.Context, dialer client.Dialer) bool {\n\tconn, err := dialer(ctx)\n\tif err != nil {\n\t\treturn false\n\t}\n\t_ = conn.Close()\n\treturn true\n}","tryCatchPattern":"conn, err := dialer(ctx)\nif err != nil {\n    return fmt.Errorf(\"failed to open the raw stream connection: %w\", err)\n}\ndefer conn.Close()","preventionTips":["Verify the daemon is running before dial-stdio.","Check DOCKER_HOST / context and socket permissions.","Restart Docker Desktop / dockerd if the socket is stale."],"tags":["system","dial-stdio","daemon","network","socket"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}