Netflix/chaosmonkey · error

'attributes.chaosMonkey.enabled' field missing

Error message

'attributes.chaosMonkey.enabled' field missing

What it means

Within attributes.chaosMonkey, the 'enabled' field must be present so fromJSON can determine whether chaos monkey is turned on for the app. A JSON enabled value of null (or the key absent) leaves the *bool nil and triggers this error.

Source

Thrown at spinnaker/fromjson.go:112

	parsed := new(parsedJSON)
	err := json.Unmarshal(js, parsed)

	if err != nil {
		return nil, errors.Wrap(err, "json unmarshal failed")
	}

	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

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Set attributes.chaosMonkey.enabled to true or false (not null) in the Spinnaker app metadata
  2. Re-save the app config through the proper chaos monkey enrollment flow so all required fields are written
  3. If you control the payload producer, default enabled to false when absent

Example fix

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

Strategy: validation

Validate before calling

var cm struct {
    Enabled *bool `json:"enabled"`
}
json.Unmarshal(cmRaw, &cm)
if cm.Enabled == nil { return errors.New("attributes.chaosMonkey.enabled must be true or false, not null") }

Type guard

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

Try / catch

cfg, err := sp.Get(app)
if err != nil {
    if strings.Contains(err.Error(), "enabled' field missing") {
        return fmt.Errorf("app %s has malformed chaosMonkey config: %w", app, err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling spinnaker.Get on a payload where attributes.chaosMonkey exists but has no 'enabled' key, or enabled is explicitly null.

Common situations: Hand-editing Spinnaker app attributes and omitting enabled; a migration or script writing partial chaosMonkey objects; older Spinnaker metadata predating the enabled field.

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