{"record":{"id":"729e068cdf87a2e5","repo":"sipeed/picoclaw","slug":"teams-webhook-failed-to-build-card-w","errorCode":null,"errorMessage":"teams_webhook: failed to build card: %w","messagePattern":"teams_webhook: failed to build card: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/teams_webhook/teams_webhook.go","lineNumber":163,"sourceCode":"\ttargetName := msg.ChatID\n\tif targetName == \"\" {\n\t\ttargetName = \"default\"\n\t}\n\n\ttarget, ok := c.config.Webhooks[targetName]\n\tif !ok {\n\t\t// Log warning and fall back to default target\n\t\tlogger.WarnCF(\"teams_webhook\", \"Unknown target, falling back to default\", map[string]any{\n\t\t\t\"requested\": msg.ChatID,\n\t\t\t\"using\":     \"default\",\n\t\t})\n\t\ttarget = c.config.Webhooks[\"default\"]\n\t}\n\n\t// Build an Adaptive Card for rich formatting\n\tcard, err := c.buildAdaptiveCard(msg, target)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"teams_webhook: failed to build card: %w\", err)\n\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)","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/teams_webhook/teams_webhook.go#L145-L181","documentation":"Error \"teams_webhook: failed to build card: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/teams_webhook/teams_webhook.go:163 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"}