wavetermdev/waveterm · error
must provide an appId to ReadAppFileCommand
Error message
must provide an appId to ReadAppFileCommand
What it means
Returned when ReadAppFileCommand is invoked without an appId; the request is invalid because reads are scoped per app.
Source
Thrown at pkg/wshrpc/wshserver/wshserver.go:1007
Mode: entry.Mode,
Modified: entry.Modified,
ModifiedTime: entry.ModifiedTime,
}
}
return &wshrpc.CommandListAllAppFilesRtnData{
Path: result.Path,
AbsolutePath: result.AbsolutePath,
ParentDir: result.ParentDir,
Entries: entries,
EntryCount: result.EntryCount,
TotalEntries: result.TotalEntries,
Truncated: result.Truncated,
}, nil
}
func (ws *WshServer) ReadAppFileCommand(ctx context.Context, data wshrpc.CommandReadAppFileData) (*wshrpc.CommandReadAppFileRtnData, error) {
if data.AppId == "" {
return nil, fmt.Errorf("must provide an appId to ReadAppFileCommand")
}
fileData, err := waveappstore.ReadAppFile(data.AppId, data.FileName)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return &wshrpc.CommandReadAppFileRtnData{
NotFound: true,
}, nil
}
return nil, fmt.Errorf("failed to read app file: %w", err)
}
return &wshrpc.CommandReadAppFileRtnData{
Data64: base64.StdEncoding.EncodeToString(fileData.Contents),
ModTs: fileData.ModTs,
}, nil
}
func (ws *WshServer) WriteAppFileCommand(ctx context.Context, data wshrpc.CommandWriteAppFileData) error {
if data.AppId == "" {View on GitHub (pinned to a4447c1563)
Solutions
- Set AppId to a valid editable-app ID (from ListAllEditableAppsCommand)
- Ensure the field is populated and serialized in the RPC request
- Validate inputs in the calling code before dispatching the RPC
Example fix
// before
f, err := client.ReadAppFileCommand(ctx, wshrpc.CommandReadAppFileData{FileName: "main.ts"})
// after
f, err := client.ReadAppFileCommand(ctx, wshrpc.CommandReadAppFileData{AppId: appId, FileName: "main.ts"}) Defensive patterns
Strategy: validation
Validate before calling
if data.AppId == "" {
return fmt.Errorf("cannot call ReadAppFileCommand: AppId is empty")
} Type guard
func hasAppId(data wshrpc.CommandReadAppFileData) bool {
return data.AppId != ""
} Try / catch
file, err := client.ReadAppFileCommand(ctx, data)
if err != nil {
if strings.Contains(err.Error(), "must provide an appId") {
// fix payload: set AppId
}
return err
}
if file.NotFound {
// missing file handled via NotFound flag, not an error
} Prevention
- Set AppId from a validated app list
- Check the NotFound response field instead of treating missing files as errors
- Validate required fields client-side
When it happens
Trigger: Calling ReadAppFileCommand with CommandReadAppFileData.AppId == "".
Common situations: AppId lost when building the request; using a default-constructed data struct; client code reading a file before resolving the app.
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
- must provide an appId to ListAllAppFilesCommand
- blockid is required
- update wavobj is nil
- error parsing command map: %w
- invalid oref string: %v
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/979c5f5b00e8f92d.
Report an issue: GitHub.