{"record":{"id":"79df90c5f951c855","repo":"wavetermdev/waveterm","slug":"getting-file-info-w-79df90","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-view.go","lineNumber":89,"sourceCode":"\t\t\t},\n\t\t\tMagnified: viewMagnified,\n\t\t\tFocused:   true,\n\t\t}\n\t} else {\n\t\tabsFile, err := filepath.Abs(fileArg)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"getting absolute path: %w\", err)\n\t\t}\n\t\tabsParent, err := filepath.Abs(filepath.Dir(fileArg))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"getting absolute path of parent dir: %w\", err)\n\t\t}\n\t\t_, err = os.Stat(absParent)\n\t\tif err == fs.ErrNotExist {\n\t\t\treturn fmt.Errorf(\"parent directory does not exist: %q\", absParent)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"getting file info: %w\", err)\n\t\t}\n\t\twshCmd = &wshrpc.CommandCreateBlockData{\n\t\t\tTabId: tabId,\n\t\t\tBlockDef: &waveobj.BlockDef{\n\t\t\t\tMeta: map[string]interface{}{\n\t\t\t\t\twaveobj.MetaKey_View: \"preview\",\n\t\t\t\t\twaveobj.MetaKey_File: absFile,\n\t\t\t\t},\n\t\t\t},\n\t\t\tMagnified: viewMagnified,\n\t\t\tFocused:   true,\n\t\t}\n\t\tif cmdName == \"edit\" {\n\t\t\twshCmd.BlockDef.Meta[waveobj.MetaKey_Edit] = true\n\t\t}\n\t\tif conn != \"\" {\n\t\t\twshCmd.BlockDef.Meta[waveobj.MetaKey_Connection] = conn\n\t\t}","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-view.go#L71-L107","documentation":"After confirming the parent directory should exist, viewRun calls os.Stat(absParent) and any stat error other than ErrNotExist (permission denied, I/O error, too many symlinks, etc.) is wrapped and returned as 'getting file info'. This signals the filesystem itself refused or failed the lookup rather than the path simply being absent.","triggerScenarios":"os.Stat on the parent dir fails with a non-ENOENT error: e.g. a permission-denied directory on the path (EACCES), an I/O error on a failing disk/network mount (EIO), or symlink loop (ELOOP).","commonSituations":"Traversing through directories without execute permission; broken NFS/SMB mounts; corrupted filesystems; FUSE mounts returning unexpected errors.","solutions":["Check permissions on each path component: `namei -l <path>` or `ls -ld` each dir","Retry after the mount/storage recovers (`df`, remount the share)","If permissions are the issue, fix them or run from a user with access"],"exampleFix":"// before\n$ wsh view /root/secret/notes.md   # EACCES traversing /root\n\n// after\n$ wsh view ~/notes.md   # path fully accessible to current user","handlingStrategy":"validation","validationCode":"if [ ! -r \"$(dirname \"$TARGET\")\" ]; then echo \"cannot access path components of $TARGET\" >&2; exit 1; }\nwsh view \"$TARGET\"","typeGuard":null,"tryCatchPattern":"try {\n  err := viewRun(cmd, args)\n  if err != nil && strings.Contains(err.Error(), \"getting file info\") {\n    // inspect wrapped os stat error: syscall.EACCES, ELOOP, EIO, etc.\n    var pe *fs.PathError\n    if errors.As(err, &pe) { log.Printf(\"stat failed: %v\", pe.Err) }\n  }\n}","preventionTips":["Check execute permission on every path component (namei -l)","Verify network mounts are healthy before accessing paths under them"],"tags":["cli","filesystem","permissions"],"backgroundTag":"filesystem-permission-denied","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}