wavetermdev/waveterm · error

recursive directory listings are not supported

Error message

recursive directory listings are not supported

What it means

RemoteListEntriesCommand rejects requests with Opts.All=true when DisableRecursiveFileOpts is set, because recursive directory walking is not permitted in this server configuration. The command returns a RespErr on the channel instead of performing fs.WalkDir.

Source

Thrown at pkg/wshrpc/wshremote/wshremote_file.go:225

			panichandler.PanicHandler("RemoteListEntriesCommand", recover())
		}()
		defer close(ch)
		path, err := wavebase.ExpandHomeDir(data.Path)
		if err != nil {
			ch <- wshutil.RespErr[wshrpc.CommandRemoteListEntriesRtnData](err)
			return
		}
		if data.Opts == nil {
			data.Opts = &wshrpc.FileListOpts{}
		}
		innerFilesEntries := []os.DirEntry{}
		seen := 0
		if data.Opts.Limit == 0 {
			data.Opts.Limit = wshrpc.MaxDirSize
		}
		if data.Opts.All {
			if DisableRecursiveFileOpts {
				ch <- wshutil.RespErr[wshrpc.CommandRemoteListEntriesRtnData](fmt.Errorf("recursive directory listings are not supported"))
				return
			}
			fs.WalkDir(os.DirFS(path), ".", func(path string, d fs.DirEntry, err error) error {
				defer func() {
					seen++
				}()
				if seen < data.Opts.Offset {
					return nil
				}
				if seen >= data.Opts.Offset+data.Opts.Limit {
					return io.EOF
				}
				if err != nil {
					return err
				}
				if d.IsDir() {
					return nil
				}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Set Opts.All=false and iterate directories manually with per-directory calls.
  2. Enable recursive listings on the server by clearing DisableRecursiveFileOpts if policy allows.
  3. Handle the RespErr on the channel gracefully and fall back to non-recursive listing.

Example fix

// before
entries := wshclient.RemoteListEntriesCommand(ctx, wshrpc.CommandRemoteListEntriesData{Path: dir, Opts: wshrpc.FileListOpts{All: true}}, nil)
// after
entries := wshclient.RemoteListEntriesCommand(ctx, wshrpc.CommandRemoteListEntriesData{Path: dir, Opts: wshrpc.FileListOpts{All: false}}, nil)
Defensive patterns

Strategy: validation

Validate before calling

if opts.All && recursiveDisabled {
    // fall back to manual per-directory traversal
    opts.All = false
}

Try / catch

for item := range ch {
    if item.Error != nil {
        if strings.Contains(item.Error.Error(), "recursive directory listings") {
            return listNonRecursive(ctx, dir)
        }
        return item.Error
    }
}

Prevention

When it happens

Trigger: Calling RemoteListEntriesCommand with {All: true} on a server where DisableRecursiveFileOpts is enabled.

Common situations: Client built assuming recursive listing support; server started with recursion disabled (e.g. for security/performance on remote hosts); version change where the option became restrictable.

Related errors


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