wavetermdev/waveterm · error

no route id available

Error message

no route id available

What it means

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.

Source

Thrown at cmd/wsh/cmd/wshcmd-file-util.go:103

		if err != nil {
			return fmt.Errorf("appending chunk to file: %w", err)
		}
	}

	return nil
}

func streamReadFromFile(ctx context.Context, fileData wshrpc.FileData, writer io.Writer) error {
	broker := RpcClient.StreamBroker
	if broker == nil {
		return fmt.Errorf("stream broker not available")
	}
	if fileData.Info == nil {
		return fmt.Errorf("file info is required")
	}
	readerRouteId := RpcClientRouteId
	if readerRouteId == "" {
		return fmt.Errorf("no route id available")
	}
	conn, err := connparse.ParseURI(fileData.Info.Path)
	if err != nil {
		return fmt.Errorf("parsing file path: %w", err)
	}
	writerRouteId := wshutil.MakeConnectionRouteId(conn.Host)
	reader, streamMeta := broker.CreateStreamReader(readerRouteId, writerRouteId, 256*1024)
	defer reader.Close()
	go func() {
		<-ctx.Done()
		reader.Close()
	}()
	data := wshrpc.CommandFileStreamData{
		Info:       fileData.Info,
		StreamMeta: *streamMeta,
	}
	_, err = wshclient.FileStreamCommand(RpcClient, data, nil)
	if err != nil {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Verify the RPC client connected: run `wsh conn status` or re-run the command to see the earlier connection error.
  2. Make sure the command's PreRunE (preRunSetupRpcClient) runs before streaming code; don't call streamReadFromFile outside the CLI lifecycle.
  3. Re-establish connectivity to the remote host (start the terminal / wsh server, fix network) and retry.
Defensive patterns

Strategy: validation

Validate before calling

if RpcClientRouteId == "" {
    return fmt.Errorf("RPC client not connected; run command through normal wsh CLI setup")
}
err := streamReadFromFile(ctx, fileData, os.Stdout)

Try / catch

if err := streamReadFromFile(ctx, fileData, w); err != nil {
    if strings.Contains(err.Error(), "no route id available") {
        // re-establish RPC connection, then retry once
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/658e4afefeeb80ca. Report an issue: GitHub.