Netflix/chaosmonkey · error

Unknown grouping: %s

Error message

Unknown grouping: %s

What it means

spinnaker.FromJSON parses a Spinnaker JSON app representation into a chaosmonkey.AppConfig. When the app is enabled ("enabled": true), the "grouping" field must be one of "app", "stack", or "cluster"; any other value (including an empty string) causes this error. If the app is disabled, an unspecified/invalid grouping is tolerated and the default (cluster) is used.

Source

Thrown at spinnaker/fromjson.go:142

	if *cm.Enabled && (*cm.MeanTimeBetweenKillsInWorkDays <= 0) {
		return nil, fmt.Errorf("invalid attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays: %d", cm.MeanTimeBetweenKillsInWorkDays)
	}

	grouping := chaosmonkey.Cluster

	switch cm.Grouping {
	case "app":
		grouping = chaosmonkey.App
	case "stack":
		grouping = chaosmonkey.Stack
	case "cluster":
		grouping = chaosmonkey.Cluster
	default:
		// If not enabled, the user may not have specified a grouping at all,
		// in which case we stick with the default
		if *cm.Enabled {
			return nil, errors.Errorf("Unknown grouping: %s", cm.Grouping)
		}
	}

	var meanTime int
	var minTime int

	if cm.MeanTimeBetweenKillsInWorkDays != nil {
		meanTime = *cm.MeanTimeBetweenKillsInWorkDays
	}

	if cm.MinTimeBetweenKillsInWorkDays != nil {
		minTime = *cm.MinTimeBetweenKillsInWorkDays
	}

	// Exceptions must have a non-blank region field
	for _, exception := range cm.Exceptions {
		if exception.Account == "" {
			return nil, errors.New("missing account field in exception")

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Set "grouping" in attributes.chaosMonkey to one of "app", "stack", or "cluster" (values are lowercase and case-sensitive)
  2. If the app should not have Chaos Monkey enabled, set "enabled": false — then grouping may be omitted
  3. Check the JSON for typos/extra whitespace in the grouping value
  4. If grouping is intentionally absent, upgrade the source system or default it before calling FromJSON

Example fix

// before
{
  "chaosMonkey": {
    "enabled": true,
    "grouping": "clusters"
  }
}
// after
{
  "chaosMonkey": {
    "enabled": true,
    "grouping": "cluster"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

func validateGrouping(cmCfg map[string]interface{}) error {
	enabled, _ := cmCfg["enabled"].(bool)
	if !enabled {
		return nil
	}
	g, ok := cmCfg["grouping"].(string)
	if !ok {
		return fmt.Errorf("grouping is required when chaosMonkey is enabled")
	}
	switch g {
	case "app", "stack", "cluster":
		return nil
	default:
		return fmt.Errorf("invalid grouping %q: must be app, stack, or cluster", g)
	}
}

Type guard

func isKnownGrouping(s string) bool {
	switch s {
	case "app", "stack", "cluster":
		return true
	}
	return false
}

Prevention

When it happens

Trigger: Calling FromJSON on JSON where attributes.chaosMonkey.enabled is true and attributes.chaosMonkey.grouping is absent, empty, misspelled (e.g. "clusters", "App" with capital), or otherwise not one of app|stack|cluster.

Common situations: Hand-edited Spinnaker app attribute JSON omitting "grouping" while enabling Chaos Monkey; case-sensitivity mistakes; UI/API versions that dropped or renamed the grouping field; typos in per-app overrides.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Netflix/chaosmonkey@eaa28fb761 (2026-09-03). Data as JSON: /api/errors/f03c2d07ae8861e1. Report an issue: GitHub.