Netflix/chaosmonkey · error

attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays missin

Error message

attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays missing

What it means

When chaos monkey is enabled for an app, fromJSON requires attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays to be present. The comment in the source notes that if enabled is false it is acceptable for this field to be missing; only an enabled config without it fails.

Source

Thrown at spinnaker/fromjson.go:118

	if parsed.Attributes == nil {
		return nil, errors.New("'attributes' field missing")
	}

	if parsed.Attributes.ChaosMonkey == nil {
		return nil, errors.New("'attributes.chaosMonkey' field missing")
	}

	cm := parsed.Attributes.ChaosMonkey

	if cm.Enabled == nil {
		return nil, errors.New("'attributes.chaosMonkey.enabled' field missing")
	}

	// Check if mean time between kills is missing.
	// If not enabled, it's ok if it's missing
	if *cm.Enabled && cm.MeanTimeBetweenKillsInWorkDays == nil {
		return nil, errors.New("attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays missing")
	}

	if *cm.Enabled && cm.MinTimeBetweenKillsInWorkDays == nil {
		return nil, errors.New("attributes.chaosMonkey.minTimeBetweenKillsInWorkDays missing")
	}

	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":

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Add a positive integer meanTimeBetweenKillsInWorkDays to attributes.chaosMonkey
  2. Re-enroll the app through the chaos monkey configuration flow which populates all required fields
  3. If chaos monkey is not actually wanted, set enabled=false so the missing field is tolerated

Example fix

// before
"chaosMonkey": {"enabled": true, "minTimeBetweenKillsInWorkDays": 1}
// after
"chaosMonkey": {"enabled": true, "meanTimeBetweenKillsInWorkDays": 5, "minTimeBetweenKillsInWorkDays": 1}
Defensive patterns

Strategy: validation

Validate before calling

var cm struct {
    Enabled                    *bool `json:"enabled"`
    MeanTimeBetweenKillsInWorkDays *int `json:"meanTimeBetweenKillsInWorkDays"`
}
json.Unmarshal(cmRaw, &cm)
if cm.Enabled != nil && *cm.Enabled && cm.MeanTimeBetweenKillsInWorkDays == nil {
    return errors.New("meanTimeBetweenKillsInWorkDays required when enabled")
}

Type guard

func hasMeanInterval(cmRaw []byte) bool {
    var p struct {
        Enabled *bool `json:"enabled"`
        Mean    *int  `json:"meanTimeBetweenKillsInWorkDays"`
    }
    return json.Unmarshal(cmRaw, &p) == nil && (p.Enabled == nil || !*p.Enabled || p.Mean != nil)
}

Try / catch

cfg, err := sp.Get(app)
if err != nil {
    if strings.Contains(err.Error(), "meanTimeBetweenKillsInWorkDays missing") {
        return fmt.Errorf("app %s: enabled chaos monkey lacks mean interval: %w", app, err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling spinnaker.Get on a payload with chaosMonkey.enabled == true but no meanTimeBetweenKillsInWorkDays key (or null).

Common situations: Manually enabling chaos monkey in Spinnaker attributes without setting the mean interval; a UI/script writing enabled=true but leaving the schedule fields empty.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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