wavetermdev/waveterm · error
parsing file path: %w
Error message
parsing file path: %w
What it means
connparse.ParseURI failed on fileData.Info.Path, and streamReadFromFile wraps it with 'parsing file path:'. The wsh CLI expects paths in its URI scheme (plain paths, or wsh://user@host/... remote paths); anything unparseable fails here.
Source
Thrown at cmd/wsh/cmd/wshcmd-file-util.go:107
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 {
return fmt.Errorf("starting file stream: %w", err)
}
_, err = io.Copy(writer, reader)
return errView on GitHub (pinned to a4447c1563)
Solutions
- Print/inspect the exact path passed and correct the URI syntax; use plain local paths or valid wsh://user@host/path form.
- Quote the argument in the shell to avoid characters being mangled.
- If path came from fixRelativePaths, check its output for corruption (double scheme prefix, empty host).
Example fix
// before wsh file cat ssh://user@host/etc/hosts // after wsh file cat wsh://user@host/etc/hosts
Defensive patterns
Strategy: validation
Validate before calling
if _, err := connparse.ParseURI(path); err != nil {
return fmt.Errorf("invalid wsh path %q: %w", path, err)
}
// path is parseable; proceed to `wsh file cat path` Try / catch
if err := runWshFileCat(path); err != nil {
var parseErr *parseErr
if strings.Contains(err.Error(), "parsing file path") {
// normalize: strip bad scheme, re-add wsh:// prefix, retry once
}
return err
} Prevention
- Use plain local paths or well-formed wsh://user@host/path URIs.
- Quote paths in the shell to protect special characters.
- Sanity-check output of fixRelativePaths for double prefixes or empty hosts.
When it happens
Trigger: `wsh file cat` given a malformed URI, e.g. `wsh://` with no host, an unsupported scheme like `ssh://host/file`, or a path with characters that break the URI parser.
Common situations: Typo in scheme (ssh:// instead of wsh://), stray characters from shell quoting, passing a Windows drive path or a URL copied from a browser into the command.
Related errors
- nil wshrpc passed to wshclient
- file info is required
- no route id available
- starting file stream: %w
- reading file: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/00a2b55665c30e52.
Report an issue: GitHub.