Netflix/chaosmonkey · error

'attributes.chaosMonkey' field missing

Error message

'attributes.chaosMonkey' field missing

What it means

fromJSON requires attributes.chaosMonkey to be present inside the Spinnaker payload. When the 'attributes' object exists but its chaosMonkey member is nil, there is no chaos monkey configuration embedded for this application, so fromJSON cannot build an AppConfig and returns this error.

Source

Thrown at spinnaker/fromjson.go:106

//	 	  	"region": "*",
//	 	  	"detail": "*"
//	 	  	}
//	 	  ]
//		  }
func fromJSON(js []byte) (*chaosmonkey.AppConfig, error) {
	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")
	}

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Enroll the application in chaos monkey so attributes.chaosMonkey is written to Spinnaker
  2. Treat this error as 'app not enrolled' and skip the app rather than failing
  3. Double-check the application name passed to Get matches the enrolled app

Example fix

// before
appConfig, err := sp.Get(appName)
if err != nil { return err }
// after
appConfig, err := sp.Get(appName)
if errors.Is(err, errNoChaosMonkeyField) || err != nil && strings.Contains(err.Error(), "attributes.chaosMonkey") {
    return nil // app not enrolled; skip
}
Defensive patterns

Strategy: validation

Validate before calling

var probe struct {
    Attributes *struct {
        ChaosMonkey *json.RawMessage `json:"chaosMonkey"`
    } `json:"attributes"`
}
if err := json.Unmarshal(body, &probe); err != nil { return err }
if probe.Attributes == nil || probe.Attributes.ChaosMonkey == nil {
    return errNotEnrolled // skip app
}

Type guard

func isChaosMonkeyConfigured(body []byte) bool {
    var p struct {
        Attributes struct {
            ChaosMonkey *map[string]any `json:"chaosMonkey"`
        } `json:"attributes"`
    }
    return json.Unmarshal(body, &p) == nil && p.Attributes.ChaosMonkey != nil
}

Try / catch

cfg, err := sp.Get(app)
if err != nil {
    if strings.Contains(err.Error(), "attributes.chaosMonkey' field missing") {
        return nil // app not enrolled in chaos monkey; skip
    }
    return err
}

Prevention

When it happens

Trigger: Calling spinnaker.Get for an application whose Spinnaker attributes contain no chaosMonkey sub-object (chaos monkey never enabled/configured for that app in Spinnaker).

Common situations: Querying a newly created application that was never enrolled in chaos monkey; the chaosMonkey metadata was deleted from the app's Spinnaker attributes; fetching the wrong application name.

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