{"record":{"id":"658e4afefeeb80ca","repo":"wavetermdev/waveterm","slug":"no-route-id-available","errorCode":null,"errorMessage":"no route id available","messagePattern":"no route id available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-file-util.go","lineNumber":103,"sourceCode":"\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"appending chunk to file: %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc streamReadFromFile(ctx context.Context, fileData wshrpc.FileData, writer io.Writer) error {\n\tbroker := RpcClient.StreamBroker\n\tif broker == nil {\n\t\treturn fmt.Errorf(\"stream broker not available\")\n\t}\n\tif fileData.Info == nil {\n\t\treturn fmt.Errorf(\"file info is required\")\n\t}\n\treaderRouteId := RpcClientRouteId\n\tif readerRouteId == \"\" {\n\t\treturn fmt.Errorf(\"no route id available\")\n\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 {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-file-util.go#L85-L121","documentation":"streamReadFromFile reads the global RpcClientRouteId, which identifies this wsh process's route on the RPC broker. If it is empty, no RPC client session has been established, so stream routes cannot be created. The guard prevents stream setup against an un-initialized connection.","triggerScenarios":"Running the stream path before setupRpcClient/preRunSetupRpcClient has run (e.g. calling streamReadFromFile programmatically without an RPC connection), or an RPC connection failure/timeout during command startup that left RpcClientRouteId unset.","commonSituations":"RPC server unreachable (no wave terminal / wsh server running on the host), wrong --connection flag, network split causing the handshake to fail so the route id is never assigned.","solutions":["Verify the RPC client connected: run `wsh conn status` or re-run the command to see the earlier connection error.","Make sure the command's PreRunE (preRunSetupRpcClient) runs before streaming code; don't call streamReadFromFile outside the CLI lifecycle.","Re-establish connectivity to the remote host (start the terminal / wsh server, fix network) and retry."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if RpcClientRouteId == \"\" {\n    return fmt.Errorf(\"RPC client not connected; run command through normal wsh CLI setup\")\n}\nerr := streamReadFromFile(ctx, fileData, os.Stdout)","typeGuard":null,"tryCatchPattern":"if err := streamReadFromFile(ctx, fileData, w); err != nil {\n    if strings.Contains(err.Error(), \"no route id available\") {\n        // re-establish RPC connection, then retry once\n    }\n    return err\n}","preventionTips":["Always invoke stream helpers via the normal CLI lifecycle (PreRunE: preRunSetupRpcClient).","Verify connection state (wsh conn status) before running file commands in scripts.","Handle upstream RPC connection failures so the route id gets set before streaming."],"tags":["go","wsh","rpc","route-id","connection"],"backgroundTag":"rpc-client-not-initialized","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}