wavetermdev/waveterm · error
tailing log file: %w
Error message
tailing log file: %w
What it means
This wraps any error from tailLogFile, the local routine that reads and streams the last 16KB (and then follows) the log file. The RPC succeeded and returned a path, but local file access or stat/seek/read failed; the cause is preserved.
Source
Thrown at cmd/wsh/cmd/wshcmd-wavepath.go:77
tabId := getTabIdFromEnv()
if tabId == "" {
return fmt.Errorf("no WAVETERM_TABID env var set")
}
path, err := wshclient.PathCommand(RpcClient, wshrpc.PathCommandData{
PathType: pathType,
Open: open,
OpenExternal: openExternal,
TabId: tabId,
}, nil)
if err != nil {
return fmt.Errorf("getting path: %w", err)
}
if tail && pathType == "log" {
err = tailLogFile(path)
if err != nil {
return fmt.Errorf("tailing log file: %w", err)
}
return nil
}
WriteStdout("%s\n", path)
return nil
}
func tailLogFile(path string) error {
file, err := os.Open(path)
if err != nil {
return fmt.Errorf("opening log file: %w", err)
}
defer file.Close()
// Get file size
stat, err := file.Stat()
if err != nil {View on GitHub (pinned to a4447c1563)
Solutions
- Check the file exists and is readable: `ls -l <path>` and `tail -c 1k <path>`.
- Fix permissions on the Wave log directory or run as the user who owns the terminal.
- Re-run the command to pick up a fresh path after log rotation.
- If tailing isn't essential, use `wsh wavepath log` without --tail.
Example fix
// before
err = tailLogFile(path) // fails on rotated file
// after
if _, err := os.Stat(path); os.IsNotExist(err) { path, err = refreshLogPath() } Defensive patterns
Strategy: retry
Validate before calling
logpath=$(wsh wavepath log) && [ -r "$logpath" ] && [ -f "$logpath" ] || exit 1
Try / catch
err := tailLogFile(path)
if err != nil {
time.Sleep(500 * time.Millisecond)
if retryErr := tailLogFile(path); retryErr != nil { return fmt.Errorf("tailing log file: %w", retryErr) }
} Prevention
- Re-fetch the path after log rotation instead of reusing old paths.
- Check readability/permissions of the Wave log directory.
- Prefer plain `wsh wavepath log` when only the path is needed.
When it happens
Trigger: `wsh wavepath log --tail` where the returned log path cannot be opened, stat'ed, seeked, or read (file deleted, rotated away, permission denied, or path points to a non-regular file).
Common situations: Log rotation removing the file between RPC and tail, running wsh as a user without read access to Wave's log dir, or log path on an unmounted volume.
Understand the failure class
Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.
Related errors
- accessing file %s: %w
- getting absolute path for %s: %w
- reading directory %s: %w
- reading file %s: %w
- opening log file: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/6dca992167bd6a1a.
Report an issue: GitHub.