sipeed/picoclaw · error
failed to create table
Error message
failed to create table: %w
What it means
Returned by parseMarkdownTable when adaptivecard.NewTableFromTableCells rejects the assembled cell grid — typically a row/column structure the library considers invalid (e.g. inconsistent column counts). The library error is wrapped with %w.
Solutions
- Inspect the wrapped error for the exact constraint violated
- Normalize the markdown table so every row has the same number of columns
- Simplify the table and retry the card build
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/channels/teams_webhook/teams_webhook.go:366 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/1d91636ecb63b564.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/channels/teams_webhook/teams_webhook.go:366
Type: adaptivecard.TypeTableCell,
Items: []*adaptivecard.Element{&textBlock},
}
tableCells = append(tableCells, cell)
}
allRows = append(allRows, tableCells)
}
if len(allRows) == 0 {
return adaptivecard.Element{}, fmt.Errorf("no valid rows found in table")
}
// Create table with first row as headers
firstRowAsHeaders := true
showGridLines := true
table, err := adaptivecard.NewTableFromTableCells(allRows, 0, firstRowAsHeaders, showGridLines)
if err != nil {
return adaptivecard.Element{}, fmt.Errorf("failed to create table: %w", err)
}
// Set column widths based on header content length
table.Columns = calculateColumnWidths(headerLengths)
return table, nil
}
// calculateColumnWidths creates TableColumnDefinition entries with widths
// proportional to the max content length of each column.
func calculateColumnWidths(maxLengths []int) []adaptivecard.Column {
if len(maxLengths) == 0 {
return nil
}
// Use content length as relative weight, with a minimum of 1
columns := make([]adaptivecard.Column, len(maxLengths))
for i, length := range maxLengths {View on GitHub (pinned to 49183d7e8d)