sipeed/picoclaw · error

teams_webhook: failed to build card: %w

Error message

teams_webhook: failed to build card: %w

What it means

Error "teams_webhook: failed to build card: %w" thrown in sipeed/picoclaw.

Source

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

	targetName := msg.ChatID
	if targetName == "" {
		targetName = "default"
	}

	target, ok := c.config.Webhooks[targetName]
	if !ok {
		// Log warning and fall back to default target
		logger.WarnCF("teams_webhook", "Unknown target, falling back to default", map[string]any{
			"requested": msg.ChatID,
			"using":     "default",
		})
		target = c.config.Webhooks["default"]
	}

	// Build an Adaptive Card for rich formatting
	card, err := c.buildAdaptiveCard(msg, target)
	if err != nil {
		return nil, fmt.Errorf("teams_webhook: failed to build card: %w", err)
	}

	// Create the message with the card
	teamsMsg, err := adaptivecard.NewMessageFromCard(card)
	if err != nil {
		return nil, fmt.Errorf("teams_webhook: failed to create message: %w", err)
	}

	// Send to Teams
	if err := c.client.SendWithContext(ctx, target.WebhookURL.String(), teamsMsg); err != nil {
		// Log without raw error to avoid leaking webhook URL (embedded in net/http errors)
		logger.ErrorCF("teams_webhook", "Failed to send message to Teams webhook", map[string]any{
			"target": msg.ChatID,
		})
		// Classify error based on status code extracted from error message.
		// The go-teams-notify library includes status in errors like "401 Unauthorized".
		// Use ClassifySendError for proper retry behavior (4xx = permanent, 5xx = temporary).
		classifiedErr := classifyTeamsError(err)

View on GitHub (pinned to 49183d7e8d)

When it happens

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