Netflix/chaosmonkey · error

unknown group: %v

Error message

unknown group: %v

What it means

respectsMinTimeBetweenKills builds a SQL query to check the minimum time between kills, appending a WHERE clause based on appCfg.Grouping. If the grouping value is not App, Stack, or Cluster, it falls through to default and returns 'unknown group: %v'. Only the three known grouping modes are supported.

Source

Thrown at mysql/mysql.go:326

		return err
	}
	query := "SELECT instance_id, killed_at FROM terminations WHERE app = ? AND account = ? AND killed_at >= ?"

	var rows *sql.Rows

	args := []interface{}{app, account, threshold.In(time.UTC)}

	switch appCfg.Grouping {
	case chaosmonkey.App:
		// nothing to do
	case chaosmonkey.Stack:
		query += " AND stack = ?"
		args = append(args, term.Instance.StackName())
	case chaosmonkey.Cluster:
		query += " AND cluster = ?"
		args = append(args, term.Instance.ClusterName())
	default:
		return errors.Errorf("unknown group: %v", appCfg.Grouping)
	}

	if appCfg.RegionsAreIndependent {
		query += " AND region = ?"
		args = append(args, term.Instance.RegionName())
	}

	// For unleashed (real) terminations, we only care about previous
	// terminations that were also unleashed. That's because a previous
	// leashed termination wasn't a real one, so that wouldn't violate
	// the min time between terminations
	if !term.Leashed {
		query += " AND leashed = FALSE"
	}

	// We need at most one entry
	query += " LIMIT 1"

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Set app.grouping in the config to one of: app, stack, cluster
  2. Log/validate appCfg.Grouping at config load time and reject unknown values early
  3. If a new grouping mode is intended, add a case for it in respectsMinTimeBetweenKills' switch
  4. Check for merge/schema changes that altered the Grouping enum values

Example fix

// before (config)
app:
  grouping: "region"
// after
app:
  grouping: "cluster"
Defensive patterns

Strategy: validation

Validate before calling

switch cfg.App().Grouping {
case chaosmonkey.App, chaosmonkey.Stack, chaosmonkey.Cluster:
    // ok
default:
    return fmt.Errorf("invalid app.grouping %v; must be app, stack, or cluster", cfg.App().Grouping)
}

Type guard

func groupingSupported(g chaosmonkey.Grouping) bool {
    switch g {
    case chaosmonkey.App, chaosmonkey.Stack, chaosmonkey.Cluster:
        return true
    }
    return false
}

Try / catch

if err := monkey.CheckWithDelay(ctx, app); err != nil {
    if strings.Contains(err.Error(), "unknown group") {
        log.Printf("grouping %q not supported by storage layer", cfg.Grouping())
    }
}

Prevention

When it happens

Trigger: An AppConfig whose Grouping field holds a value other than chaosmonkey.App, chaosmonkey.Stack, or chaosmonkey.Cluster reaches CheckWithDelay → respectsMinTimeBetweenKills.

Common situations: Config file containing an invalid grouping string (e.g. 'region', typo like 'stacks') that deserializes into an out-of-range value; a schema/config version change introducing a new grouping not yet supported by the MySQL layer.

Related errors


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