iced-rs/iced · error
table row
Error message
table row
What it means
The markdown parser asserts that a table row exists when appending a cell to it via rows.last_mut().expect("table row"). Rows are pushed when a table's separator/header line is parsed, so this panic means a cell line was processed without a preceding valid table header/separator - an internal parser invariant violation.
Source
Thrown at widget/src/markdown.rs:937
let Scope::Table {
alignment,
columns,
rows,
current,
} = stack.last_mut()?
else {
return None;
};
if columns.len() < alignment.len() {
columns.push(Column {
header: std::mem::take(current),
alignment: alignment[columns.len()],
});
} else {
rows.last_mut()
.expect("table row")
.cells
.push(std::mem::take(current));
}
None
}
_ => None,
},
pulldown_cmark::Event::Text(text) if !metadata => {
if code_block {
code.push_str(&text);
#[cfg(feature = "highlighter")]
if let Some(highlighter) = &mut code_parser {
for line in text.lines() {
code_lines.push(Text::new(highlighter.parse_line(line).to_vec()));
}
}View on GitHub (pinned to d146509d89)
Solutions
- Validate/sanitize the markdown before rendering: every table body must be preceded by a header row and a |---| delimiter row.
- Inspect the input around the failing table and fix its syntax (missing or malformed delimiter line is the usual cause).
- If content is untrusted, escape or pre-parse tables defensively, or pin the iced/iced_widgets version where your input is known to parse.
- Report/upgrade: if the input is valid CommonMark, this is a parser bug - check for fixes in newer iced_widget releases.
Example fix
// before (input) | a | b | | c | d | // after (input - add delimiter row) | a | b | |---|---| | c | d |
Defensive patterns
Strategy: validation
Validate before calling
// check tables are well-formed before handing markdown to the widget
fn table_has_delimiter(md: &str) -> bool {
// every line starting with '|' body must be preceded by a |---| row
let mut prev_sep = false;
for line in md.lines() {
let is_pipe = line.trim_start().starts_with('|');
let is_sep = is_pipe && line.chars().all(|c| c == '|' || c == '-' || c == ':' || c.is_whitespace());
if is_pipe && !is_sep && !prev_sep { return false; }
prev_sep = is_sep;
}
true
} Prevention
- Sanitize user-supplied markdown tables before rendering.
- Add a unit test rendering all markdown fixtures used in your app.
- Pin the iced version your content is verified against.
- Report valid-CommonMark inputs that panic as upstream bugs.
When it happens
Trigger: Feeding markdown where a table body line (|a|b|) appears without a matching header+delimiter row, or malformed delimiter rows (e.g. |---|---| with wrong column alignment array length) such that the parser reaches the cell branch with rows empty.
Common situations: User-supplied markdown content with a near-miss table syntax (missing separator line, leading blank line removal quirks), or content truncated mid-table; can also surface when a previous alignment array indexed columns.len() out of range earlier in the same block.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Line must be parsed
- Caches must not be empty
- Downcast widget state
- Downcast on stateless state
- {error:?}
AI-assisted analysis of iced-rs/iced@d146509d89 (2026-09-11).
Data as JSON: /api/errors/9b0fe0cfe97b8763.
Report an issue: GitHub.