wavetermdev/waveterm · error
no route id available
Error message
no route id available
What it means
Read needs the package-level RpcClientRouteId to know which route the local stream reader listens on. If it is empty, the client was never assigned a route id during initialization, and Read refuses to build the stream. Like RpcClient, this global must be set by whoever initializes the client (main-server or wshcmd-connserver).
Source
Thrown at pkg/remote/fileshare/wshfs/wshfs.go:57
}
return conn, nil
}
func Read(ctx context.Context, data wshrpc.FileData) (*wshrpc.FileData, error) {
if data.Info == nil {
return nil, fmt.Errorf("file info is required")
}
log.Printf("Read: %v", data.Info.Path)
conn, err := parseConnection(ctx, data.Info.Path)
if err != nil {
return nil, err
}
broker := RpcClient.StreamBroker
if broker == nil {
return nil, fmt.Errorf("stream broker not available")
}
if RpcClientRouteId == "" {
return nil, fmt.Errorf("no route id available")
}
readerRouteId := RpcClientRouteId
writerRouteId := wshutil.MakeConnectionRouteId(conn.Host)
reader, streamMeta := broker.CreateStreamReader(readerRouteId, writerRouteId, 256*1024)
defer reader.Close()
go func() {
<-ctx.Done()
reader.Close()
}()
byteRange := ""
if data.At != nil && data.At.Size > 0 {
byteRange = fmt.Sprintf("%d-%d", data.At.Offset, data.At.Offset+int64(data.At.Size)-1)
}
remoteData := wshrpc.CommandRemoteFileStreamData{
Path: conn.Path,
ByteRange: byteRange,
StreamMeta: *streamMeta,
}View on GitHub (pinned to a4447c1563)
Solutions
- Set wshfs.RpcClientRouteId (via the wshutil route registration for the RPC client) during startup before serving file commands
- Log the route id at startup to confirm it is populated
- Guard/queue file operations until initialization completes
Example fix
// before wshfs.RpcClient = rpc // route id never assigned // after wshfs.RpcClient = rpc wshfs.RpcClientRouteId = wshutil.SetupRouterKit(rpc) // assign route before use
Defensive patterns
Strategy: validation
Validate before calling
if wshfs.RpcClientRouteId == "" {
return errors.New("wshfs route id not initialized; set RpcClientRouteId during setup")
} Type guard
func routeReady() bool {
return wshfs.RpcClientRouteId != ""
} Try / catch
out, err := wshfs.Read(ctx, data)
if err != nil {
if strings.Contains(err.Error(), "no route id available") {
return fmt.Errorf("initialization incomplete (route id empty): %w", err)
}
return err
} Prevention
- Assign RpcClientRouteId immediately after creating/registering the RPC client
- Gate request handling behind an init-done flag so requests cannot arrive early
- Log the route id at startup for diagnosability
- Keep route setup in one shared initializer used by all entry points
When it happens
Trigger: Calling wshfs.Read when wshfs.RpcClientRouteId is still "" — i.e. the embedding binary never called the route-id registration that populates it, or Read runs before that registration.
Common situations: Custom tool linking wshfs without performing the wsh router registration; race where a request arrives during startup before route assignment; recent refactor dropped the SetRouteId call.
Related errors
- no default route
- static files not available before app initialization; use Ap
- route did not establish after successful reconnection: %w
- stream broker not available
- invalid routeid %q
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/9257071a48c4702a.
Report an issue: GitHub.