sipeed/picoclaw · error

teams_webhook: webhook

Error message

teams_webhook: webhook %q has empty webhook_url

What it means

Construction-time guard in NewTeamsWebhookChannel: while iterating cfg.Webhooks, a target named in the %q placeholder rendered an empty webhook_url after .String(). The constructor rejects the whole config because an empty URL would fail at send time with a less diagnosable HTTP error.

Solutions

  1. Set a non-empty webhook_url for the named target in the teams_webhook config
  2. Check for YAML indentation mistakes that leave the webhook_url key outside the target entry
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

func NewTeamsWebhookChannel(
	bc *config.Channel,
	cfg *config.TeamsWebhookSettings,
	bus *bus.MessageBus,
) (*TeamsWebhookChannel, error) {
	if len(cfg.Webhooks) == 0 {
		return nil, fmt.Errorf("teams_webhook: at least one webhook target is required")
	}

	// Require "default" webhook target
	if _, hasDefault := cfg.Webhooks["default"]; !hasDefault {
		return nil, fmt.Errorf("teams_webhook: a 'default' webhook target is required")
	}

	// Validate all webhook targets have valid HTTPS URLs
	for name, target := range cfg.Webhooks {
		webhookURL := target.WebhookURL.String()
		if webhookURL == "" {
			return nil, fmt.Errorf("teams_webhook: webhook %q has empty webhook_url", name)
		}
		parsed, err := url.Parse(webhookURL)
		if err != nil {
			return nil, fmt.Errorf("teams_webhook: webhook %q has invalid URL: %w", name, err)
		}
		if !strings.EqualFold(parsed.Scheme, "https") {
			return nil, fmt.Errorf("teams_webhook: webhook %q must use HTTPS (got %q)", name, parsed.Scheme)
		}
	}

	base := channels.NewBaseChannel(
		"teams_webhook",
		cfg,
		bus,
		[]string{
			"*",
		}, // Output-only channel; "*" suppresses misleading "allows EVERYONE" audit warning
		channels.WithMaxMessageLength(24000), // Power Automate webhook payload limit is 28KB

View on GitHub (pinned to 49183d7e8d)