{"record":{"id":"9f748084e4831514","repo":"wavetermdev/waveterm","slug":"starting-file-stream-w","errorCode":null,"errorMessage":"starting file stream: %w","messagePattern":"starting file stream: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-file-util.go","lineNumber":122,"sourceCode":"\t}\n\tconn, err := connparse.ParseURI(fileData.Info.Path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing file path: %w\", err)\n\t}\n\twriterRouteId := wshutil.MakeConnectionRouteId(conn.Host)\n\treader, streamMeta := broker.CreateStreamReader(readerRouteId, writerRouteId, 256*1024)\n\tdefer reader.Close()\n\tgo func() {\n\t\t<-ctx.Done()\n\t\treader.Close()\n\t}()\n\tdata := wshrpc.CommandFileStreamData{\n\t\tInfo:       fileData.Info,\n\t\tStreamMeta: *streamMeta,\n\t}\n\t_, err = wshclient.FileStreamCommand(RpcClient, data, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"starting file stream: %w\", err)\n\t}\n\t_, err = io.Copy(writer, reader)\n\treturn err\n}\n\nfunc fixRelativePaths(path string) (string, error) {\n\tconn, err := connparse.ParseURI(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif conn.Scheme == connparse.ConnectionTypeWsh {\n\t\tif conn.Host == connparse.ConnHostCurrent {\n\t\t\tconn.Host = RpcContext.Conn\n\t\t\tfixedPath, err := fileutil.FixPath(conn.Path)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tconn.Path = fixedPath","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-file-util.go#L104-L140","documentation":"After setting up the stream reader, the CLI issues a FileStreamCommand RPC to the remote host to start streaming the file. If that RPC fails (connection error, remote rejects the request, timeout), the error is wrapped with 'starting file stream:'.","triggerScenarios":"Remote wsh server not running or unreachable, the remote rejects FileStreamCommand (path not readable, permission denied), RPC timeout, or the stream route vanished because the connection dropped mid-setup.","commonSituations":"Cats a file on a remote host whose wsh server is stale (version mismatch after terminal update), SSH connection dropped, reading a file the remote user lacks permission for.","solutions":["Re-run the command to confirm connectivity; check `wsh conn status` for the target host.","Verify the file path exists and is readable on the remote host (`wsh file info <path>`).","Update wsh on the remote host to match the terminal version; restart the connection.","Increase the RPC timeout or check network/SSH stability if it is a transient drop."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})\nif err != nil {\n    return fmt.Errorf(\"file unreachable, skipping stream: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := streamReadFromFile(ctx, fileData, out)\nif err != nil && strings.Contains(err.Error(), \"starting file stream\") {\n    // check connectivity, refresh connection, then retry once\n    return fmt.Errorf(\"stream start failed: %w\", err)\n}","preventionTips":["Confirm the remote wsh server is running and version-matched with the client.","Pre-check the file with `wsh file info <path>` before streaming.","Retry once on transient RPC failures; keep SSH/network sessions stable during transfers."],"tags":["go","wsh","rpc","file-stream","remote"],"backgroundTag":"rpc-request-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}