{"record":{"id":"ffbf0588c56628d7","repo":"Netflix/chaosmonkey","slug":"attributes-chaosmonkey-enabled-field-missing","errorCode":null,"errorMessage":"'attributes.chaosMonkey.enabled' field missing","messagePattern":"'attributes\\.chaosMonkey\\.enabled' field missing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/fromjson.go","lineNumber":112,"sourceCode":"\tparsed := new(parsedJSON)\n\terr := json.Unmarshal(js, parsed)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"json unmarshal failed\")\n\t}\n\n\tif parsed.Attributes == nil {\n\t\treturn nil, errors.New(\"'attributes' field missing\")\n\t}\n\n\tif parsed.Attributes.ChaosMonkey == nil {\n\t\treturn nil, errors.New(\"'attributes.chaosMonkey' field missing\")\n\t}\n\n\tcm := parsed.Attributes.ChaosMonkey\n\n\tif cm.Enabled == nil {\n\t\treturn nil, errors.New(\"'attributes.chaosMonkey.enabled' field missing\")\n\t}\n\n\t// Check if mean time between kills is missing.\n\t// If not enabled, it's ok if it's missing\n\tif *cm.Enabled && cm.MeanTimeBetweenKillsInWorkDays == nil {\n\t\treturn nil, errors.New(\"attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays missing\")\n\t}\n\n\tif *cm.Enabled && cm.MinTimeBetweenKillsInWorkDays == nil {\n\t\treturn nil, errors.New(\"attributes.chaosMonkey.minTimeBetweenKillsInWorkDays missing\")\n\t}\n\n\tif *cm.Enabled && (*cm.MeanTimeBetweenKillsInWorkDays <= 0) {\n\t\treturn nil, fmt.Errorf(\"invalid attributes.chaosMonkey.meanTimeBetweenKillsInWorkDays: %d\", cm.MeanTimeBetweenKillsInWorkDays)\n\t}\n\n\tgrouping := chaosmonkey.Cluster\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/fromjson.go#L94-L130","documentation":"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.","triggerScenarios":"Calling spinnaker.Get on a payload where attributes.chaosMonkey exists but has no 'enabled' key, or enabled is explicitly null.","commonSituations":"Hand-editing Spinnaker app attributes and omitting enabled; a migration or script writing partial chaosMonkey objects; older Spinnaker metadata predating the enabled field.","solutions":["Set attributes.chaosMonkey.enabled to true or false (not null) in the Spinnaker app metadata","Re-save the app config through the proper chaos monkey enrollment flow so all required fields are written","If you control the payload producer, default enabled to false when absent"],"exampleFix":"// before\n\"chaosMonkey\": {\"meanTimeBetweenKillsInWorkDays\": 5}\n// after\n\"chaosMonkey\": {\"enabled\": true, \"meanTimeBetweenKillsInWorkDays\": 5, \"minTimeBetweenKillsInWorkDays\": 1}","handlingStrategy":"validation","validationCode":"var cm struct {\n    Enabled *bool `json:\"enabled\"`\n}\njson.Unmarshal(cmRaw, &cm)\nif cm.Enabled == nil { return errors.New(\"attributes.chaosMonkey.enabled must be true or false, not null\") }","typeGuard":"func enabledIsSet(cmRaw []byte) bool {\n    var p struct{ Enabled *bool `json:\"enabled\"` }\n    return json.Unmarshal(cmRaw, &p) == nil && p.Enabled != nil\n}","tryCatchPattern":"cfg, err := sp.Get(app)\nif err != nil {\n    if strings.Contains(err.Error(), \"enabled' field missing\") {\n        return fmt.Errorf(\"app %s has malformed chaosMonkey config: %w\", app, err)\n    }\n    return err\n}","preventionTips":["Always write both true/false explicitly, never null, when editing attributes","Use the official enrollment flow rather than hand-editing Spinnaker metadata","Schema-validate chaosMonkey objects before persisting them"],"tags":["go","json","spinnaker","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"eaa28fb761c0ebe8644d1333e5d164e9cc3071e9","analyzedAt":"2026-09-03T17:04:39.020Z","contentChangedAt":"2026-09-03T17:04:39.020Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}