wavetermdev/waveterm · error

must provide an appId to ListAllAppFilesCommand

Error message

must provide an appId to ListAllAppFilesCommand

What it means

Returned when ListAllAppFilesCommand is invoked without an appId; the request is invalid because file listing is scoped per app.

Source

Thrown at pkg/wshrpc/wshserver/wshserver.go:976

		rtn = append(rtn, wshrpc.WorkspaceInfoData{
			WindowId:      workspaceEntry.WindowId,
			WorkspaceData: workspaceData,
		})
	}
	return rtn, nil
}

func (ws *WshServer) ListAllAppsCommand(ctx context.Context) ([]wshrpc.AppInfo, error) {
	return waveappstore.ListAllApps()
}

func (ws *WshServer) ListAllEditableAppsCommand(ctx context.Context) ([]wshrpc.AppInfo, error) {
	return waveappstore.ListAllEditableApps()
}

func (ws *WshServer) ListAllAppFilesCommand(ctx context.Context, data wshrpc.CommandListAllAppFilesData) (*wshrpc.CommandListAllAppFilesRtnData, error) {
	if data.AppId == "" {
		return nil, fmt.Errorf("must provide an appId to ListAllAppFilesCommand")
	}
	result, err := waveappstore.ListAllAppFiles(data.AppId)
	if err != nil {
		return nil, err
	}
	entries := make([]wshrpc.DirEntryOut, len(result.Entries))
	for i, entry := range result.Entries {
		entries[i] = wshrpc.DirEntryOut{
			Name:         entry.Name,
			Dir:          entry.Dir,
			Symlink:      entry.Symlink,
			Size:         entry.Size,
			Mode:         entry.Mode,
			Modified:     entry.Modified,
			ModifiedTime: entry.ModifiedTime,
		}
	}
	return &wshrpc.CommandListAllAppFilesRtnData{

View on GitHub (pinned to a4447c1563)

Solutions

  1. Fetch available apps via ListAllEditableAppsCommand and pass a valid AppId
  2. Ensure the AppId field is serialized in the RPC payload
  3. Validate AppId non-empty in client code before the call

Example fix

// before
files, err := client.ListAllAppFilesCommand(ctx, wshrpc.CommandListAllAppFilesData{})
// after
files, err := client.ListAllAppFilesCommand(ctx, wshrpc.CommandListAllAppFilesData{AppId: appId})
Defensive patterns

Strategy: validation

Validate before calling

if data.AppId == "" {
    return fmt.Errorf("cannot call ListAllAppFilesCommand: AppId is empty")
}

Type guard

func hasAppId(data wshrpc.CommandListAllAppFilesData) bool {
    return data.AppId != ""
}

Try / catch

files, err := client.ListAllAppFilesCommand(ctx, data)
if err != nil {
    if strings.Contains(err.Error(), "must provide an appId") {
        // resolve appId via ListAllEditableAppsCommand
    }
    return err
}

Prevention

When it happens

Trigger: Calling ListAllAppFilesCommand with CommandListAllAppFilesData.AppId == "".

Common situations: Client forgot to resolve an app via ListAllEditableAppsCommand first; passing a zero-value struct; JSON payload omitting appid.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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