wavetermdev/waveterm · error

getting file info: %w

Error message

getting file info: %w

What it means

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.

Source

Thrown at cmd/wsh/cmd/wshcmd-view.go:89

			},
			Magnified: viewMagnified,
			Focused:   true,
		}
	} else {
		absFile, err := filepath.Abs(fileArg)
		if err != nil {
			return fmt.Errorf("getting absolute path: %w", err)
		}
		absParent, err := filepath.Abs(filepath.Dir(fileArg))
		if err != nil {
			return fmt.Errorf("getting absolute path of parent dir: %w", err)
		}
		_, err = os.Stat(absParent)
		if err == fs.ErrNotExist {
			return fmt.Errorf("parent directory does not exist: %q", absParent)
		}
		if err != nil {
			return fmt.Errorf("getting file info: %w", err)
		}
		wshCmd = &wshrpc.CommandCreateBlockData{
			TabId: tabId,
			BlockDef: &waveobj.BlockDef{
				Meta: map[string]interface{}{
					waveobj.MetaKey_View: "preview",
					waveobj.MetaKey_File: absFile,
				},
			},
			Magnified: viewMagnified,
			Focused:   true,
		}
		if cmdName == "edit" {
			wshCmd.BlockDef.Meta[waveobj.MetaKey_Edit] = true
		}
		if conn != "" {
			wshCmd.BlockDef.Meta[waveobj.MetaKey_Connection] = conn
		}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check permissions on each path component: `namei -l <path>` or `ls -ld` each dir
  2. Retry after the mount/storage recovers (`df`, remount the share)
  3. If permissions are the issue, fix them or run from a user with access

Example fix

// before
$ wsh view /root/secret/notes.md   # EACCES traversing /root

// after
$ wsh view ~/notes.md   # path fully accessible to current user
Defensive patterns

Strategy: validation

Validate before calling

if [ ! -r "$(dirname "$TARGET")" ]; then echo "cannot access path components of $TARGET" >&2; exit 1; }
wsh view "$TARGET"

Try / catch

try {
  err := viewRun(cmd, args)
  if err != nil && strings.Contains(err.Error(), "getting file info") {
    // inspect wrapped os stat error: syscall.EACCES, ELOOP, EIO, etc.
    var pe *fs.PathError
    if errors.As(err, &pe) { log.Printf("stat failed: %v", pe.Err) }
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: Traversing through directories without execute permission; broken NFS/SMB mounts; corrupted filesystems; FUSE mounts returning unexpected errors.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/79df90c5f951c855. Report an issue: GitHub.