Netflix/chaosmonkey · error
'attributes' field missing
Error message
'attributes' field missing
What it means
fromJSON parses a Spinnaker pipeline/execution payload and requires a top-level 'attributes' object. If the JSON unmarshals but parsed.Attributes is nil, the payload has no attributes field, so a chaos-monkey AppConfig cannot be derived. The error is returned from fromJSON, which is invoked by spinnaker.Get.
Source
Thrown at spinnaker/fromjson.go:102
// "whitelist": [
// {
// "account": "test",
// "stack": "*",
// "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")
}
View on GitHub (pinned to eaa28fb761)
Solutions
- Verify the Spinnaker endpoint URL and fetch path used by the Get call return the expected entity with an 'attributes' object
- Log the raw response body when this error occurs to confirm what was actually returned
- Check Spinnaker authentication (cert/key/user config) — a failed auth often yields a payload without attributes
- Confirm the Spinnaker API version still nests chaos monkey config under attributes
Example fix
// before: fetching wrong URL body := fetch(baseURL + "/pipelines") // after: fetch the entity endpoint that returns attributes body := fetch(baseURL + "/applications/myapp/serverGroups")
Defensive patterns
Strategy: validation
Validate before calling
var raw map[string]json.RawMessage
if err := json.Unmarshal(body, &raw); err != nil { return err }
if _, ok := raw["attributes"]; !ok { return errors.New("payload has no attributes field") } Type guard
func hasAttributes(body []byte) bool {
var p struct{ Attributes map[string]any `json:"attributes"` }
return json.Unmarshal(body, &p) == nil && p.Attributes != nil
} Try / catch
cfg, err := sp.Get(app)
if err != nil {
if strings.Contains(err.Error(), "'attributes' field missing") {
log.Printf("non-standard Spinnaker payload for %s: %v", app, err)
return errUnexpectedPayload
}
return err
} Prevention
- Log the raw response body when parsing fails to spot HTML/error payloads
- Verify Spinnaker endpoint URLs and auth before deploying
- Pin and test against the Spinnaker API version you depend on
When it happens
Trigger: Calling spinnaker.Get (which calls fromJSON) on JSON whose root object lacks an 'attributes' key, e.g. an error response, an empty object {}, or a non-Spinnaker payload.
Common situations: Pointing chaos monkey at the wrong Spinnaker endpoint or path so it receives HTML/JSON error bodies; Spinnaker API version changes that reshape the response; misconfigured authentication causing an error payload to be returned instead of the real entity.
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
- 'attributes.chaosMonkey' field missing
- 'attributes.chaosMonkey.enabled' field missing
- attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays missin
- attributes.chaosMonkey.minTimeBetweenKillsInWorkDays missing
- missing account field in exception
AI-assisted analysis of Netflix/chaosmonkey@eaa28fb761 (2026-09-03).
Data as JSON: /api/errors/51b0977b3f25c325.
Report an issue: GitHub.