charmbracelet/gum · error

invalid data provided

Error message

invalid data provided

What it means

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`.

Source

Thrown at table/command.go:67

	writer := csv.NewWriter(os.Stdout)
	writer.Comma = separatorRunes[0]

	var columnNames []string
	var err error
	// If no columns are provided we'll use the first row of the CSV as the
	// column names.
	if len(o.Columns) <= 0 {
		columnNames, err = reader.Read()
		if err != nil {
			return fmt.Errorf("unable to parse columns")
		}
	} else {
		columnNames = o.Columns
	}

	data, err := reader.ReadAll()
	if err != nil {
		return fmt.Errorf("invalid data provided")
	}
	columns := make([]table.Column, 0, len(columnNames))

	for i, title := range columnNames {
		width := lipgloss.Width(title)
		if len(o.Widths) > i {
			width = o.Widths[i]
		}
		columns = append(columns, table.Column{
			Title: title,
			Width: width,
		})
	}

	defaultStyles := table.DefaultStyles()
	top, right, bottom, left := style.ParsePadding(o.Padding)

	styles := table.Styles{

View on GitHub (pinned to 4d089f9550)

Solutions

  1. Fix the CSV syntax of the input data (balanced quotes, consistent delimiter)
  2. Verify the upstream command producing the input succeeds before piping into gum table
  3. Check the input file/stream is valid UTF-8 text and not empty/corrupted
  4. Run the data source alone (e.g. `cat data.csv`) to confirm it emits parseable CSV

Example fix

// before
cat broken.csv | gum table   // malformed quotes: "a,b',c
// after
cat fixed.csv | gum table    // "a,b",c
Defensive patterns

Strategy: validation

Validate before calling

# Validate CSV before piping to gum table
python3 -c "import csv,sys; list(csv.reader(open(sys.argv[1])))" data.csv && cat data.csv | gum table

Try / catch

if ! gum table < data.csv 2>err.txt; then
  cat err.txt >&2
  exit 1
fi

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


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