Netflix/chaosmonkey · error

attributes.chaosMonkey.minTimeBetweenKillsInWorkDays missing

Error message

attributes.chaosMonkey.minTimeBetweenKillsInWorkDays missing

What it means

When chaos monkey is enabled, fromJSON also requires attributes.chaosMonkey.minTimeBetweenKillsInWorkDays. An enabled config lacking this key (nil pointer) returns this error; it is only enforced when enabled is true.

Source

Thrown at spinnaker/fromjson.go:122

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

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Add a positive integer minTimeBetweenKillsInWorkDays to attributes.chaosMonkey
  2. Re-save the app's chaos monkey configuration via the standard flow
  3. Set enabled=false if the app should not be enrolled, so the field is optional

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling spinnaker.Get on a payload with chaosMonkey.enabled == true but minTimeBetweenKillsInWorkDays absent or null.

Common situations: Partially filled chaos monkey config in Spinnaker attributes; automation writing enabled/mean fields but skipping the min interval; older configs created before the min field was introduced.

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/09d11ac746dccbf8. Report an issue: GitHub.