{"record":{"id":"aa5e1ea9708d2ed2","repo":"charmbracelet/gum","slug":"no-data-provided","errorCode":null,"errorMessage":"no data provided","messagePattern":"no data provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"table/command.go","lineNumber":33,"sourceCode":"\t\"charm.land/lipgloss/v2\"\n\tltable \"charm.land/lipgloss/v2/table\"\n\t\"golang.org/x/text/encoding\"\n\t\"golang.org/x/text/encoding/unicode\"\n\t\"golang.org/x/text/transform\"\n)\n\n// Run provides a shell script interface for rendering tabular data (CSV).\nfunc (o Options) Run() error {\n\tvar input *os.File\n\tif o.File != \"\" {\n\t\tvar err error\n\t\tinput, err = os.Open(o.File)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not render file: %w\", err)\n\t\t}\n\t} else {\n\t\tif stdin.IsEmpty() {\n\t\t\treturn fmt.Errorf(\"no data provided\")\n\t\t}\n\t\tinput = os.Stdin\n\t}\n\tdefer input.Close() //nolint: errcheck\n\n\ttransformer := unicode.BOMOverride(encoding.Nop.NewDecoder())\n\treader := csv.NewReader(transform.NewReader(input, transformer))\n\treader.LazyQuotes = o.LazyQuotes\n\treader.FieldsPerRecord = o.FieldsPerRecord\n\tseparatorRunes := []rune(o.Separator)\n\tif len(separatorRunes) != 1 {\n\t\treturn fmt.Errorf(\"separator must be single character\")\n\t}\n\treader.Comma = separatorRunes[0]\n\n\twriter := csv.NewWriter(os.Stdout)\n\twriter.Comma = separatorRunes[0]\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/table/command.go#L15-L51","documentation":"Gum table requires tabular data: either via --file or piped through stdin. When neither is provided (stdin is empty), Run returns 'no data provided' before attempting to render.","triggerScenarios":"Running bare `gum table` with no piped input; an upstream command in a pipeline produced empty output (`grep nomatch data.csv | gum table`); feeding /dev/null.","commonSituations":"Scripting pipelines where a filter matched nothing; forgetting to redirect a file into stdin; automation running gum table non-interactively with no input attached.","solutions":["Pipe CSV data: `cat data.csv | gum table`.","Use --file: `gum table --file data.csv`.","Guard the pipeline: check the upstream output is non-empty before calling gum table.","In scripts, verify `[ ! -s input.csv ]` conditions before invoking."],"exampleFix":"// before\ngrep \"failed\" report.csv | gum table   # may be empty\n// after\nout=$(grep \"failed\" report.csv); [ -n \"$out\" ] && echo \"$out\" | gum table","handlingStrategy":"validation","validationCode":"if [ ! -s data.csv ]; then echo \"no data\" >&2; exit 0; fi\ngum table --file data.csv","typeGuard":null,"tryCatchPattern":"if ! out=$(cat data.csv | gum table); then echo \"no/invalid data\" >&2; fi","preventionTips":["Verify input is non-empty ([ -s file ]) before piping","Guard pipelines where upstream filters may match nothing","Provide --file as an alternative to stdin"],"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"}