spectreconsole/spectre.console · error · InvalidOperationException
Column spanning is not supported in table footer rows.
Error message
Column spanning is not supported in table footer rows.
What it means
The TableColumn.Footer setter, like Header, forbids column-spanning cells. Assigning a TableCell whose ColumnSpan > 1 to Footer throws InvalidOperationException. Spanning is permitted only in body rows; footer layout cannot merge columns.
Source
Thrown at src/Spectre.Console/Widgets/Table/TableColumn.cs:38
{
throw new InvalidOperationException("Column spanning is not supported in table header rows.");
}
_header = value ?? throw new ArgumentNullException(nameof(value));
}
}
/// <summary>
/// Gets or sets the column footer.
/// </summary>
public IRenderable? Footer
{
get => _footer;
set
{
if (value is TableCell cell && cell.ColumnSpan > 1)
{
throw new InvalidOperationException("Column spanning is not supported in table footer rows.");
}
_footer = value;
}
}
/// <summary>
/// Gets or sets the width of the column.
/// If <c>null</c>, the column will adapt to its contents.
/// </summary>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the padding of the column.
/// Vertical padding (top and bottom) is ignored.
/// </summary>
public Padding? Padding { get; set; }
View on GitHub (pinned to 0acc92fada)
Solutions
- Assign a plain renderable (new Markup(text)) to Footer, not a spanned TableCell.
- Create a separate non-spanning cell instance for the footer rather than reusing a body cell.
- If a merged footer is required, render it as a separate table/caption outside the footer row.
Example fix
// before
column.Footer = new TableCell("Total").Span(2);
// after
column.Footer = new Markup("Total"); Defensive patterns
Strategy: validation
Validate before calling
var footerCell = value as TableCell;
if (footerCell is not null && footerCell.ColumnSpan > 1)
throw new InvalidOperationException("Footers cannot span columns.");
column.Footer = value; Type guard
static bool IsSafeFooter(IRenderable r) => r is not TableCell tc || tc.ColumnSpan <= 1;
Prevention
- Assign plain Markup to footers, never spanned TableCells.
- Build footer cells from a span-free source.
- Do not reuse body cells as footers.
When it happens
Trigger: Setting column.Footer = new TableCell(text).Span(2); reusing a spanning body TableCell as a footer; constructing footers via a shared cell factory that applies spans.
Common situations: Wanting a 'Total' footer that spans several columns (unsupported); reusing a body TableCell for the footer row; assuming Footer follows the same rules as body rows.
Related errors
- Column spanning is not supported in table {rowType} rows.
- Column spanning is not supported in table header rows.
- The number of row columns (including spans) are greater than
- Cannot add new columns to table with existing rows.
- Column span must be at least 1.
AI-assisted analysis of spectreconsole/spectre.console@0acc92fada (2026-08-13).
Data as JSON: /api/errors/fc3cd353432c341b.
Report an issue: GitHub.