{"record":{"id":"c60aa9f0f5873f82","repo":"wavetermdev/waveterm","slug":"getting-file-info-w-c60aa9","errorCode":null,"errorMessage":"getting file info: %w","messagePattern":"getting file info: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-file.go","lineNumber":199,"sourceCode":"\t\treturn fmt.Errorf(\"reading file: %w\", err)\n\t}\n\n\treturn nil\n}\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)","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-file.go#L181-L217","documentation":"fileInfoRun calls the FileInfoCommand RPC and wraps failures with 'getting file info:'. This fires when the RPC to fetch file metadata on the target host fails at the transport level (not for a simply-missing file, which is handled separately).","triggerScenarios":"`wsh file info <path>` where the RPC fails: no RPC connection, timeout (fileTimeout exceeded), remote wsh server not running, or connection dropped during the call.","commonSituations":"Querying info on a remote host that is offline or whose wsh server is stale, slow network exceeding the RPC timeout, running the command without a connected wave terminal.","solutions":["Check connectivity to the target host and re-run the command.","Retry on transient timeouts; increase fileTimeout if the network is slow.","Ensure the remote wsh server version matches the client; update wsh remotely.","Confirm you are connected (wsh conn status) before running file commands."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// confirm connectivity before the RPC\nif err := checkConnection(); err != nil {\n    return fmt.Errorf(\"not connected: %w\", err)\n}\ninfo, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})","typeGuard":null,"tryCatchPattern":"info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})\nif err != nil {\n    // transient? retry once with backoff before surfacing\n    return fmt.Errorf(\"getting file info: %w\", err)\n}","preventionTips":["Run `wsh conn status` before scripted file operations.","Use a generous fileTimeout for slow networks.","Keep remote wsh updated to match the client version."],"tags":["go","wsh","rpc","file-info","timeout"],"backgroundTag":"rpc-request-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}