wavetermdev/waveterm · error
%s: no such file
Error message
%s: no such file
What it means
After a successful FileInfoCommand, the response itself can carry NotFound=true, meaning the remote stat succeeded but the path does not exist. The CLI formats this as '<path>: no such file', mirroring the classic ls/stat error message.
Source
Thrown at cmd/wsh/cmd/wshcmd-file.go:203
}
func fileInfoRun(cmd *cobra.Command, args []string) error {
path, err := fixRelativePaths(args[0])
if err != nil {
return err
}
fileData := wshrpc.FileData{
Info: &wshrpc.FileInfo{
Path: path}}
info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
err = convertNotFoundErr(err)
if err != nil {
return fmt.Errorf("getting file info: %w", err)
}
if info.NotFound {
return fmt.Errorf("%s: no such file", path)
}
WriteStdout("name:\t%s\n", info.Name)
if info.Mode != 0 {
WriteStdout("mode:\t%s\n", info.Mode.String())
}
WriteStdout("mtime:\t%s\n", time.Unix(info.ModTime/1000, 0).Format(time.DateTime))
if !info.IsDir {
WriteStdout("size:\t%d\n", info.Size)
}
if info.Meta != nil && len(*info.Meta) > 0 {
WriteStdout("metadata:\n")
for k, v := range *info.Meta {
WriteStdout("\t\t\t%s: %v\n", k, v)
}
}
return nil
}View on GitHub (pinned to a4447c1563)
Solutions
- Verify the exact path on the target host; use `wsh ls <dir>` on the parent directory.
- Check host/scheme in the argument (local vs wsh://user@host/...) — the file may exist on a different machine.
- Watch for case-sensitivity and trailing-slash differences between local and remote filesystems.
Example fix
// before wsh file info ~/config.yml # file only exists locally // after wsh file info wsh://user@ec2/home/user/config.yml
Defensive patterns
Strategy: try-catch
Validate before calling
info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
if err == nil && info.NotFound {
return fmt.Errorf("%s does not exist on target host", path)
} Try / catch
out, err := runWshFileInfo(path)
if err != nil && strings.HasSuffix(strings.TrimSpace(err.Error()), ": no such file") {
// handle missing-file path: create it, or correct the path/host
} Prevention
- List the parent directory (`wsh ls <dir>`) to confirm exact spelling and case.
- Explicitly state the target host in the path (wsh://user@host/...) to avoid wrong-machine resolution.
- Remember remote filesystems are case-sensitive even if your laptop is not.
When it happens
Trigger: `wsh file info <path>` where the path does not exist on the target host: typo in filename, wrong working directory assumption, file deleted between listing and info, or relative path resolved against an unexpected remote cwd.
Common situations: Case-sensitivity mismatch (macOS local vs Linux remote), path valid locally but not on the remote host, missing wsh:// prefix causing resolution on the wrong machine.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- getting file info: %w
- nil wshrpc passed to wshclient
- file info is required
- no route id available
- parsing file path: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/4591fd22be6e6b92.
Report an issue: GitHub.