sipeed/picoclaw · error

table must have at least header and separator rows

Error message

table must have at least header and separator rows

What it means

Guard inside parseMarkdownTable: the markdown table fragment passed in has fewer than two lines, so there is no header row plus separator row (the |---|---| line) to build column structure from. It fires when the table-segmenting regex matches something too short to be a real table.

Solutions

  1. Ensure markdown tables include both a header row and a |---| separator row
  2. If the model output truncated the table, regenerate the message
  3. Treat single-line pseudo-tables as plain text instead of table syntax
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/channels/teams_webhook/teams_webhook.go:314 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/ef3b7aa800b4cd40. Report an issue: GitHub.

Appendix: source

Thrown at pkg/channels/teams_webhook/teams_webhook.go:314

		lastEnd = match[1]
	}

	// Text after the last table
	if lastEnd < len(content) {
		segments = append(segments, contentSegment{
			content: content[lastEnd:],
			isTable: false,
		})
	}

	return segments
}

// parseMarkdownTable converts a markdown table string to an Adaptive Card Table element.
func parseMarkdownTable(tableStr string) (adaptivecard.Element, error) {
	lines := strings.Split(strings.TrimSpace(tableStr), "\n")
	if len(lines) < 2 {
		return adaptivecard.Element{}, fmt.Errorf("table must have at least header and separator rows")
	}

	// Track header content length per column for width calculation
	var headerLengths []int

	// Parse all rows (header + data rows, skip separator)
	var allRows [][]adaptivecard.TableCell
	for i, line := range lines {
		// Skip separator row (contains only |, -, :, and spaces)
		if i == 1 && isSeparatorRow(line) {
			continue
		}

		cells := parseTableRow(line)
		if len(cells) == 0 {
			continue
		}

View on GitHub (pinned to 49183d7e8d)