charmbracelet/gum · warning

provide some content to display

Error message

provide some content to display

What it means

The gum pager (Run in pager/command.go) refuses to start when it has no content to display. Content is expected either via stdin or the embedded file content; if the sanitized stdin string is empty the command returns this error instead of launching an empty bubbletea program.

Source

Thrown at pager/command.go:30

)

// Run provides a shell script interface for the viewport bubble.
// https://github.com/charmbracelet/bubbles/viewport
func (o Options) Run() error {
	vp := viewport.New(viewport.WithWidth(o.Style.Width), viewport.WithHeight(o.Style.Height))
	vp.Style = o.Style.ToLipgloss()

	if o.Content == "" {
		stdin, err := stdin.Read()
		if err != nil {
			return fmt.Errorf("unable to read stdin")
		}
		if stdin != "" {
			// Sanitize the input from stdin by removing backspace sequences.
			backspace := regexp.MustCompile(".\x08")
			o.Content = backspace.ReplaceAllString(stdin, "")
		} else {
			return fmt.Errorf("provide some content to display")
		}
	}

	m := model{
		viewport:            vp,
		help:                help.New(),
		content:             o.Content,
		origContent:         o.Content,
		showLineNumbers:     o.ShowLineNumbers,
		lineNumberStyle:     o.LineNumberStyle.ToLipgloss(),
		softWrap:            o.SoftWrap,
		matchStyle:          o.MatchStyle.ToLipgloss(),
		matchHighlightStyle: o.MatchHighlightStyle.ToLipgloss(),
		keymap:              defaultKeymap(),
	}

	ctx, cancel := timeout.Context(o.Timeout)
	defer cancel()

View on GitHub (pinned to 4d089f9550)

Solutions

  1. Pipe the content you want to display: `cat file.md | gum pager`.
  2. Check that the upstream command actually produced output before invoking gum pager (e.g. `[ -s file ] && cat file | gum pager`).
  3. If programmatically calling Run(), set Options.Content (or ensure stdin is non-empty) before calling Run.

Example fix

// before (empty stdin)
"" | gum pager
// after
cat README.md | gum pager
Defensive patterns

Strategy: validation

Validate before calling

content=$(cat file.md)
if [ -z "$content" ]; then echo "nothing to display" >&2; else printf '%s' "$content" | gum pager; fi

Try / catch

if ! out=$(cat f.md | gum pager); then echo "pager failed: $out" >&2; fi

Prevention

When it happens

Trigger: Calling gum pager with no piped stdin and no content, or piping an empty stream (e.g. `'' | gum pager`, `grep nomatch file | gum pager`).

Common situations: Scripting pipelines where an upstream command produced no output, or forgetting to pipe a file: `cat NOTES.md | gum pager`.

Related errors


AI-assisted analysis of charmbracelet/gum@4d089f9550 (2026-08-31). Data as JSON: /api/errors/198440b62ad84a2d. Report an issue: GitHub.