{"record":{"id":"0408202e5210216e","repo":"charmbracelet/gum","slug":"invalid-data-provided","errorCode":null,"errorMessage":"invalid data provided","messagePattern":"invalid data provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"table/command.go","lineNumber":67,"sourceCode":"\twriter := csv.NewWriter(os.Stdout)\n\twriter.Comma = separatorRunes[0]\n\n\tvar columnNames []string\n\tvar err error\n\t// If no columns are provided we'll use the first row of the CSV as the\n\t// column names.\n\tif len(o.Columns) <= 0 {\n\t\tcolumnNames, err = reader.Read()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to parse columns\")\n\t\t}\n\t} else {\n\t\tcolumnNames = o.Columns\n\t}\n\n\tdata, err := reader.ReadAll()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid data provided\")\n\t}\n\tcolumns := make([]table.Column, 0, len(columnNames))\n\n\tfor i, title := range columnNames {\n\t\twidth := lipgloss.Width(title)\n\t\tif len(o.Widths) > i {\n\t\t\twidth = o.Widths[i]\n\t\t}\n\t\tcolumns = append(columns, table.Column{\n\t\t\tTitle: title,\n\t\t\tWidth: width,\n\t\t})\n\t}\n\n\tdefaultStyles := table.DefaultStyles()\n\ttop, right, bottom, left := style.ParsePadding(o.Padding)\n\n\tstyles := table.Styles{","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/table/command.go#L49-L85","documentation":"gum table fails to render a table because the CSV/data reader returned an error while reading input rows. The library wraps the reader failure as 'invalid data provided' since the table cannot be built without row data. It indicates malformed or unreadable input passed to `gum table`.","triggerScenarios":"Running `gum table` when the CSV reader (usually stdin) fails to parse or read the input data; `reader.ReadAll()` returns an error, e.g. malformed CSV with inconsistent quoting or a closed/broken input pipe.","commonSituations":"Piping malformed CSV into `gum table` (unbalanced quotes, ragged quoting), input stream closed prematurely by an upstream command that crashed, or reading from a file with encoding issues (e.g. binary or invalid UTF-8).","solutions":["Fix the CSV syntax of the input data (balanced quotes, consistent delimiter)","Verify the upstream command producing the input succeeds before piping into gum table","Check the input file/stream is valid UTF-8 text and not empty/corrupted","Run the data source alone (e.g. `cat data.csv`) to confirm it emits parseable CSV"],"exampleFix":"// before\ncat broken.csv | gum table   // malformed quotes: \"a,b',c\n// after\ncat fixed.csv | gum table    // \"a,b\",c","handlingStrategy":"validation","validationCode":"# Validate CSV before piping to gum table\npython3 -c \"import csv,sys; list(csv.reader(open(sys.argv[1])))\" data.csv && cat data.csv | gum table","typeGuard":null,"tryCatchPattern":"if ! gum table < data.csv 2>err.txt; then\n  cat err.txt >&2\n  exit 1\nfi","preventionTips":["Lint CSV files before feeding them to gum table","Test the data-producing command's exit status first","Avoid binary or non-UTF-8 input"],"tags":["csv","input","parsing"],"backgroundTag":"invalid-input-data","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}