{"record":{"id":"4591fd22be6e6b92","repo":"wavetermdev/waveterm","slug":"s-no-such-file","errorCode":null,"errorMessage":"%s: no such file","messagePattern":"(.+?): no such file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-file.go","lineNumber":203,"sourceCode":"}\n\nfunc fileInfoRun(cmd *cobra.Command, args []string) error {\n\tpath, err := fixRelativePaths(args[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\tfileData := wshrpc.FileData{\n\t\tInfo: &wshrpc.FileInfo{\n\t\t\tPath: path}}\n\n\tinfo, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})\n\terr = convertNotFoundErr(err)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting file info: %w\", err)\n\t}\n\n\tif info.NotFound {\n\t\treturn fmt.Errorf(\"%s: no such file\", path)\n\t}\n\n\tWriteStdout(\"name:\\t%s\\n\", info.Name)\n\tif info.Mode != 0 {\n\t\tWriteStdout(\"mode:\\t%s\\n\", info.Mode.String())\n\t}\n\tWriteStdout(\"mtime:\\t%s\\n\", time.Unix(info.ModTime/1000, 0).Format(time.DateTime))\n\tif !info.IsDir {\n\t\tWriteStdout(\"size:\\t%d\\n\", info.Size)\n\t}\n\tif info.Meta != nil && len(*info.Meta) > 0 {\n\t\tWriteStdout(\"metadata:\\n\")\n\t\tfor k, v := range *info.Meta {\n\t\t\tWriteStdout(\"\\t\\t\\t%s: %v\\n\", k, v)\n\t\t}\n\t}\n\treturn nil\n}","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-file.go#L185-L221","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":"// before\nwsh file info ~/config.yml   # file only exists locally\n// after\nwsh file info wsh://user@ec2/home/user/config.yml","handlingStrategy":"try-catch","validationCode":"info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})\nif err == nil && info.NotFound {\n    return fmt.Errorf(\"%s does not exist on target host\", path)\n}","typeGuard":null,"tryCatchPattern":"out, err := runWshFileInfo(path)\nif err != nil && strings.HasSuffix(strings.TrimSpace(err.Error()), \": no such file\") {\n    // handle missing-file path: create it, or correct the path/host\n}","preventionTips":["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."],"tags":["go","wsh","file-info","not-found"],"backgroundTag":"file-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}