wavetermdev/waveterm · error
getting file info: %w
Error message
getting file info: %w
What it means
After successfully creating a missing file, ensureFile re-queries FileInfoCommand to fetch the new file's info. If that second RPC fails, the error is wrapped as "getting file info". It means the file was created but its metadata could not be read back.
Source
Thrown at cmd/wsh/cmd/wshcmd-file-util.go:41
return nil
}
if strings.HasPrefix(err.Error(), "NOTFOUND:") {
return fs.ErrNotExist
}
return err
}
func ensureFile(fileData wshrpc.FileData) (*wshrpc.FileInfo, error) {
info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
err = convertNotFoundErr(err)
if err == fs.ErrNotExist {
err = wshclient.FileCreateCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
if err != nil {
return nil, fmt.Errorf("creating file: %w", err)
}
info, err = wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
if err != nil {
return nil, fmt.Errorf("getting file info: %w", err)
}
return info, err
}
if err != nil {
return nil, fmt.Errorf("getting file info: %w", err)
}
return info, nil
}
func streamWriteToFile(fileData wshrpc.FileData, reader io.Reader) error {
// First truncate the file with an empty write
emptyWrite := fileData
emptyWrite.Data64 = ""
err := wshclient.FileWriteCommand(RpcClient, emptyWrite, &wshrpc.RpcOpts{Timeout: fileTimeout})
if err != nil {
return fmt.Errorf("initializing file with empty write: %w", err)
}
View on GitHub (pinned to a4447c1563)
Solutions
- Simply retry the append command — the create+info sequence is usually transient.
- Increase the RPC timeout if operating over a high-latency connection.
- Verify with `wsh ls` that the file now exists and is readable.
- Check the wsh server logs on the remote host for the underlying RPC error.
Defensive patterns
Strategy: retry
Try / catch
info, err := ensureFile(fileData)
if err != nil {
time.Sleep(500 * time.Millisecond)
info, err = ensureFile(fileData) // transient RPC failures usually clear
} Prevention
- Avoid concurrent processes creating/deleting the same path
- Increase fileTimeout on slow remote links
- Ensure the wsh server is not restarting mid-command
When it happens
Trigger: FileInfoCommand (post-create) fails due to RPC timeout (fileTimeout), transient connection drop between create and the info call, or a race where another process deleted the file right after creation.
Common situations: Slow or flaky remote connection exceeding the fileTimeout; concurrent jobs creating/deleting the same path; wsh server briefly restarting mid-command.
Related errors
- failed to list workspaces: %v
- failed to list blocks from all %d workspace(s)
- reinstalling connection: %w
- disconnecting %q error: %w
- ensuring connection: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/6ce6028e70b8c21b.
Report an issue: GitHub.