amir20/dozzle · error

failed to decode config

Error message

failed to decode config: %w

What it means

LoadConfig decodes the notifications YAML from disk and wraps any YAML syntax or schema error. The file at ./data/notifications.yml is malformed (bad indentation, wrong types, or invalid YAML), so no notification state is loaded and the persisted config is effectively unusable until fixed.

Solutions

  1. Validate the YAML file syntax (indentation, colons, quoting) with a linter.
  2. Check that field types match Config (e.g. dispatcher ids are ints, subscriptions are lists).
  3. Restore the file from a backup or delete it to reset notification state; it is regenerated on next save.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/notification/config.go:44 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at internal/notification/config.go:44

	config := Config{
		Subscriptions: m.Subscriptions(),
		Dispatchers:   dispatchers,
	}

	encoder := yaml.NewEncoder(w)
	defer encoder.Close()

	return encoder.Encode(config)
}

// LoadConfig reads configuration from a reader in YAML format and loads it
func (m *Manager) LoadConfig(r io.Reader) error {
	var config Config

	decoder := yaml.NewDecoder(r)
	if err := decoder.Decode(&config); err != nil {
		return fmt.Errorf("failed to decode config: %w", err)
	}

	// Convert to types for HandleNotificationConfig
	subscriptions := make([]types.SubscriptionConfig, len(config.Subscriptions))
	for i, sub := range config.Subscriptions {
		subscriptions[i] = types.SubscriptionConfig{
			ID:                  sub.ID,
			Name:                sub.Name,
			Enabled:             sub.Enabled,
			DispatcherID:        sub.DispatcherID,
			LogExpression:       sub.LogExpression,
			ContainerExpression: sub.ContainerExpression,
			MetricExpression:    sub.MetricExpression,
			EventExpression:     sub.EventExpression,
			Cooldown:            sub.Cooldown,
			SampleWindow:        sub.SampleWindow,
		}
	}

View on GitHub (pinned to d9463cbe21)