pulumi/pulumi · error
running pager: %w
Error message
running pager: %w
What it means
The no-op pager's runNoopPager copies the command output through an io.Pipe to stdout. If the copy fails mid-stream (e.g. the writing goroutine's function errored and closed the pipe writer, or stdout became unwritable), the error is wrapped as "running pager: %w". Despite the message, this is in the fallback (non-pager) path.
Source
Thrown at pkg/cmd/esc/cli/pager/noop.go:39
)
func runNoopPager(stdout io.Writer, f func(context.Context, io.Writer) error) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
r, stdin := io.Pipe()
defer r.Close()
done := make(chan error)
go func() {
done <- func() error {
defer stdin.Close()
return f(ctx, stdin)
}()
}()
if _, err := io.Copy(stdout, r); err != nil {
return fmt.Errorf("running pager: %w", err)
}
cancel()
return <-done
}
View on GitHub (pinned to 793f7b2e16)
Solutions
- Check the wrapped cause: an EPIPE usually means the downstream consumer (head, grep -q) closed early — handle SIGPIPE or avoid closing early
- Retry the command writing directly to a file instead of a pipe
- Capture output to a file (`> out.json`) to rule out pipe issues
- If the producer function failed, inspect its error for the root cause
Defensive patterns
Strategy: try-catch
Validate before calling
// prefer capturing to a file to avoid pipe failures esc env get my-env --output json > out.json
Try / catch
out, err := exec.Command("esc", "env", "get", "my-env").Output()
if err != nil {
var ee *exec.ExitError
if errors.As(err, &ee) && isBrokenPipe(ee) {
// downstream consumer (head, grep -q) closed the pipe: treat as benign
return nil
}
return err
} Prevention
- Avoid piping output into commands that exit early (head, grep -q) or handle SIGPIPE
- Capture output to a file when chaining commands in scripts
- Check that stdout is writable in the execution environment
When it happens
Trigger: Output is written through the pipe while the producer function f(ctx, stdin) fails and closes the writer prematurely, or io.Copy fails writing to stdout (broken pipe, e.g. `esc ... | head` closing downstream, or a full/closed stdout).
Common situations: Piping ESC CLI output into `head` or a command that exits early, causing EPIPE on stdout; downstream consumer crashes while the CLI is streaming JSON output.
Related errors
- reading environment definition: %w
- could not read from stdin: %w
- running pager: %w
- reading role details from stdin: %w
- reading role details from %q: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/f5a062c1d1f726bf.
Report an issue: GitHub.