sipeed/picoclaw · error
teams_webhook: send failed
Error message
teams_webhook: send failed: %w
What it means
Returned by TeamsWebhookChannel.Send when client.SendWithContext fails to deliver the message to the Teams webhook. The raw error is deliberately not logged or wrapped in detail because net/http errors embed the full webhook URL (a secret); the code classifies the failure by HTTP status code extracted from the error message.
Solutions
- Classify via the status code: 4xx (e.g. 400/401/404) means bad payload or expired webhook — fix or rotate the webhook; 5xx/429 are transient — retry with backoff
- Check Azure/Teams service health for sustained 5xx
- Verify the webhook URL has not been rotated or deleted in the Teams admin side
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/channels/teams_webhook/teams_webhook.go:182 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/685453a5896f022f.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/channels/teams_webhook/teams_webhook.go:182
}
// 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)
return nil, fmt.Errorf("teams_webhook: send failed: %w", classifiedErr)
}
logger.DebugCF("teams_webhook", "Message sent successfully", map[string]any{
"target": msg.ChatID,
})
return nil, nil
}
// buildAdaptiveCard creates a formatted Adaptive Card from the outbound message.
// It detects markdown tables and converts them to native Adaptive Card Table elements,
// since TextBlocks only support a limited markdown subset (no tables).
func (c *TeamsWebhookChannel) buildAdaptiveCard(
msg bus.OutboundMessage,
target config.TeamsWebhookTarget,
) (adaptivecard.Card, error) {
card := adaptivecard.NewCard()
card.Type = adaptivecard.TypeAdaptiveCardView on GitHub (pinned to 49183d7e8d)