{"record":{"id":"685453a5896f022f","repo":"sipeed/picoclaw","slug":"teams-webhook-send-failed-w","errorCode":null,"errorMessage":"teams_webhook: send failed: %w","messagePattern":"teams_webhook: send failed: %w","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/teams_webhook/teams_webhook.go","lineNumber":182,"sourceCode":"\t}\n\n\t// Create the message with the card\n\tteamsMsg, err := adaptivecard.NewMessageFromCard(card)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"teams_webhook: failed to create message: %w\", err)\n\t}\n\n\t// Send to Teams\n\tif err := c.client.SendWithContext(ctx, target.WebhookURL.String(), teamsMsg); err != nil {\n\t\t// Log without raw error to avoid leaking webhook URL (embedded in net/http errors)\n\t\tlogger.ErrorCF(\"teams_webhook\", \"Failed to send message to Teams webhook\", map[string]any{\n\t\t\t\"target\": msg.ChatID,\n\t\t})\n\t\t// Classify error based on status code extracted from error message.\n\t\t// The go-teams-notify library includes status in errors like \"401 Unauthorized\".\n\t\t// Use ClassifySendError for proper retry behavior (4xx = permanent, 5xx = temporary).\n\t\tclassifiedErr := classifyTeamsError(err)\n\t\treturn nil, fmt.Errorf(\"teams_webhook: send failed: %w\", classifiedErr)\n\t}\n\n\tlogger.DebugCF(\"teams_webhook\", \"Message sent successfully\", map[string]any{\n\t\t\"target\": msg.ChatID,\n\t})\n\n\treturn nil, nil\n}\n\n// buildAdaptiveCard creates a formatted Adaptive Card from the outbound message.\n// It detects markdown tables and converts them to native Adaptive Card Table elements,\n// since TextBlocks only support a limited markdown subset (no tables).\nfunc (c *TeamsWebhookChannel) buildAdaptiveCard(\n\tmsg bus.OutboundMessage,\n\ttarget config.TeamsWebhookTarget,\n) (adaptivecard.Card, error) {\n\tcard := adaptivecard.NewCard()\n\tcard.Type = adaptivecard.TypeAdaptiveCard","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/teams_webhook/teams_webhook.go#L164-L200","documentation":"Error \"teams_webhook: send failed: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/teams_webhook/teams_webhook.go:182 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}