{"record":{"id":"198440b62ad84a2d","repo":"charmbracelet/gum","slug":"provide-some-content-to-display","errorCode":null,"errorMessage":"provide some content to display","messagePattern":"provide some content to display","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pager/command.go","lineNumber":30,"sourceCode":")\n\n// Run provides a shell script interface for the viewport bubble.\n// https://github.com/charmbracelet/bubbles/viewport\nfunc (o Options) Run() error {\n\tvp := viewport.New(viewport.WithWidth(o.Style.Width), viewport.WithHeight(o.Style.Height))\n\tvp.Style = o.Style.ToLipgloss()\n\n\tif o.Content == \"\" {\n\t\tstdin, err := stdin.Read()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to read stdin\")\n\t\t}\n\t\tif stdin != \"\" {\n\t\t\t// Sanitize the input from stdin by removing backspace sequences.\n\t\t\tbackspace := regexp.MustCompile(\".\\x08\")\n\t\t\to.Content = backspace.ReplaceAllString(stdin, \"\")\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"provide some content to display\")\n\t\t}\n\t}\n\n\tm := model{\n\t\tviewport:            vp,\n\t\thelp:                help.New(),\n\t\tcontent:             o.Content,\n\t\torigContent:         o.Content,\n\t\tshowLineNumbers:     o.ShowLineNumbers,\n\t\tlineNumberStyle:     o.LineNumberStyle.ToLipgloss(),\n\t\tsoftWrap:            o.SoftWrap,\n\t\tmatchStyle:          o.MatchStyle.ToLipgloss(),\n\t\tmatchHighlightStyle: o.MatchHighlightStyle.ToLipgloss(),\n\t\tkeymap:              defaultKeymap(),\n\t}\n\n\tctx, cancel := timeout.Context(o.Timeout)\n\tdefer cancel()","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/pager/command.go#L12-L48","documentation":"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.","triggerScenarios":"Calling gum pager with no piped stdin and no content, or piping an empty stream (e.g. `'' | gum pager`, `grep nomatch file | gum pager`).","commonSituations":"Scripting pipelines where an upstream command produced no output, or forgetting to pipe a file: `cat NOTES.md | gum pager`.","solutions":["Pipe the content you want to display: `cat file.md | gum pager`.","Check that the upstream command actually produced output before invoking gum pager (e.g. `[ -s file ] && cat file | gum pager`).","If programmatically calling Run(), set Options.Content (or ensure stdin is non-empty) before calling Run."],"exampleFix":"// before (empty stdin)\n\"\" | gum pager\n// after\ncat README.md | gum pager","handlingStrategy":"validation","validationCode":"content=$(cat file.md)\nif [ -z \"$content\" ]; then echo \"nothing to display\" >&2; else printf '%s' \"$content\" | gum pager; fi","typeGuard":null,"tryCatchPattern":"if ! out=$(cat f.md | gum pager); then echo \"pager failed: $out\" >&2; fi","preventionTips":["Always pipe non-empty content into gum pager","Check upstream command output size before paging","Set Options.Content explicitly when calling Run() programmatically"],"tags":["cli","input-validation","empty-input"],"backgroundTag":"empty-stdin-input","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}