{"record":{"id":"09d11ac746dccbf8","repo":"Netflix/chaosmonkey","slug":"attributes-chaosmonkey-mintimebetweenkillsinworkda","errorCode":null,"errorMessage":"attributes.chaosMonkey.minTimeBetweenKillsInWorkDays missing","messagePattern":"attributes\\.chaosMonkey\\.minTimeBetweenKillsInWorkDays missing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/fromjson.go","lineNumber":122,"sourceCode":"\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\n\tswitch cm.Grouping {\n\tcase \"app\":\n\t\tgrouping = chaosmonkey.App\n\tcase \"stack\":\n\t\tgrouping = chaosmonkey.Stack\n\tcase \"cluster\":\n\t\tgrouping = chaosmonkey.Cluster\n\tdefault:\n\t\t// If not enabled, the user may not have specified a grouping at all,\n\t\t// in which case we stick with the default","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/fromjson.go#L104-L140","documentation":"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.","triggerScenarios":"Calling spinnaker.Get on a payload with chaosMonkey.enabled == true but minTimeBetweenKillsInWorkDays absent or null.","commonSituations":"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.","solutions":["Add a positive integer minTimeBetweenKillsInWorkDays to attributes.chaosMonkey","Re-save the app's chaos monkey configuration via the standard flow","Set enabled=false if the app should not be enrolled, so the field is optional"],"exampleFix":"// before\n\"chaosMonkey\": {\"enabled\": true, \"meanTimeBetweenKillsInWorkDays\": 5}\n// after\n\"chaosMonkey\": {\"enabled\": true, \"meanTimeBetweenKillsInWorkDays\": 5, \"minTimeBetweenKillsInWorkDays\": 1}","handlingStrategy":"validation","validationCode":"var cm struct {\n    Enabled                  *bool `json:\"enabled\"`\n    MinTimeBetweenKillsInWorkDays *int `json:\"minTimeBetweenKillsInWorkDays\"`\n}\njson.Unmarshal(cmRaw, &cm)\nif cm.Enabled != nil && *cm.Enabled && cm.MinTimeBetweenKillsInWorkDays == nil {\n    return errors.New(\"minTimeBetweenKillsInWorkDays required when enabled\")\n}","typeGuard":"func hasMinInterval(cmRaw []byte) bool {\n    var p struct {\n        Enabled *bool `json:\"enabled\"`\n        Min     *int  `json:\"minTimeBetweenKillsInWorkDays\"`\n    }\n    return json.Unmarshal(cmRaw, &p) == nil && (p.Enabled == nil || !*p.Enabled || p.Min != nil)\n}","tryCatchPattern":"cfg, err := sp.Get(app)\nif err != nil {\n    if strings.Contains(err.Error(), \"minTimeBetweenKillsInWorkDays missing\") {\n        return fmt.Errorf(\"app %s: enabled chaos monkey lacks min interval: %w\", app, err)\n    }\n    return err\n}","preventionTips":["Set min <= mean whenever configuring kill intervals","Validate both intervals together in config-writing tooling","Document required fields for anyone hand-editing app attributes"],"tags":["go","json","spinnaker","missing-field","config-validation"],"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"}