amir20/dozzle · error

API key is required for cloud dispatcher

Error message

API key is required for cloud dispatcher

What it means

NewCloudDispatcher is a constructor guard: the Dozzle Cloud dispatcher requires an API key credential, and an empty key was supplied. Without it the dispatcher cannot authenticate to the cloud events endpoint, so construction fails rather than creating a dispatcher that would fail on every send.

Solutions

  1. Provide the API key from the cloud configuration (cloud.yml / UpdateCloudConfig).
  2. If cloud notifications are not wanted, do not create a cloud dispatcher at all instead of passing an empty key.
  3. Re-authenticate with Dozzle Cloud to obtain a fresh, non-empty API key.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/notification/dispatcher/cloud.go:39 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/15e3302249d73b23. Report an issue: GitHub.

Appendix: source

Thrown at internal/notification/dispatcher/cloud.go:39

	Name         string
	URL          string
	APIKey       string
	Prefix       string
	ExpiresAt    *time.Time
	client       *http.Client
	blockedUntil atomic.Int64
}

// NewCloudDispatcher creates a new cloud dispatcher
func NewCloudDispatcher(name string, apiKey string, prefix string, expiresAt *time.Time) (*CloudDispatcher, error) {
	url := os.Getenv("DOLIGENCE_URL")
	if url == "" {
		url = "https://doligence.dozzle.dev"
	}
	url = url + "/api/events"

	if apiKey == "" {
		return nil, fmt.Errorf("API key is required for cloud dispatcher")
	}

	return &CloudDispatcher{
		Name:      name,
		URL:       url,
		APIKey:    apiKey,
		Prefix:    prefix,
		ExpiresAt: expiresAt,
		client: &http.Client{
			Timeout: 10 * time.Second,
		},
	}, nil
}

const defaultRetryAfter = 60 * time.Second

// unauthorizedRetryAfter is how long to back off after an auth failure (invalid/expired
// API key). Retrying won't help until the user fixes their key, which recreates the

View on GitHub (pinned to d9463cbe21)