Netflix/chaosmonkey · error

missing account field in exception

Error message

missing account field in exception

What it means

Every entry in attributes.chaosMonkey.exceptions must specify an account. fromJSON iterates the exceptions list and returns this error if any exception's Account field is an empty string, since an exception without an account cannot be matched against Spinnaker deployments.

Source

Thrown at spinnaker/fromjson.go:160

			return nil, errors.Errorf("Unknown grouping: %s", cm.Grouping)
		}
	}

	var meanTime int
	var minTime int

	if cm.MeanTimeBetweenKillsInWorkDays != nil {
		meanTime = *cm.MeanTimeBetweenKillsInWorkDays
	}

	if cm.MinTimeBetweenKillsInWorkDays != nil {
		minTime = *cm.MinTimeBetweenKillsInWorkDays
	}

	// Exceptions must have a non-blank region field
	for _, exception := range cm.Exceptions {
		if exception.Account == "" {
			return nil, errors.New("missing account field in exception")
		}

		if exception.Region == "" {
			return nil, errors.New("missing region field in exception")
		}
	}

	cfg := chaosmonkey.AppConfig{
		Enabled:                        *cm.Enabled,
		RegionsAreIndependent:          cm.RegionsAreIndependent,
		Grouping:                       grouping,
		MeanTimeBetweenKillsInWorkDays: meanTime,
		MinTimeBetweenKillsInWorkDays:  minTime,
		Exceptions:                     cm.Exceptions,
		Whitelist:                      cm.Whitelist,
	}

	return &cfg, nil

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Add the cloud account name to every exception object in attributes.chaosMonkey.exceptions
  2. Remove the incomplete exception entry if it is not needed
  3. Validate the exceptions JSON before saving it to Spinnaker

Example fix

// before
"exceptions": [{"region": "us-east-1"}]
// after
"exceptions": [{"account": "prod-account", "region": "us-east-1"}]
Defensive patterns

Strategy: validation

Validate before calling

var cm struct {
    Exceptions []struct {
        Account string `json:"account"`
    } `json:"exceptions"`
}
json.Unmarshal(cmRaw, &cm)
for i, e := range cm.Exceptions {
    if e.Account == "" { return fmt.Errorf("exception %d missing account", i) }
}

Type guard

func exceptionsHaveAccounts(cmRaw []byte) bool {
    var p struct {
        Exceptions []struct{ Account string `json:"account"` } `json:"exceptions"`
    }
    if json.Unmarshal(cmRaw, &p) != nil { return false }
    for _, e := range p.Exceptions { if e.Account == "" { return false } }
    return true
}

Try / catch

cfg, err := sp.Get(app)
if err != nil {
    if strings.Contains(err.Error(), "missing account field in exception") {
        return fmt.Errorf("app %s has malformed exception entries: %w", app, err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling spinnaker.Get on a payload whose chaosMonkey.exceptions array contains an object like {"region":"us-east-1"} with no account key (or account: "").

Common situations: Hand-writing exception entries in the app's Spinnaker attributes; copy-pasting an exception and forgetting to fill in account; tooling emitting partial exception objects.

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