Netflix/chaosmonkey · error

missing region field in exception

Error message

missing region field in exception

What it means

Every entry in attributes.chaosMonkey.exceptions must also specify a region. fromJSON returns this error when an exception has a non-empty account but an empty Region, because the comment in source states exceptions must have a non-blank region field.

Source

Thrown at spinnaker/fromjson.go:164

	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
}

// parsedJson is the parsed JSON representation
type parsedJSON struct {

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Add the region (e.g. "us-east-1") to every exception object in attributes.chaosMonkey.exceptions
  2. If the intent is to exempt the whole account, create one exception entry per region in that account
  3. Strip out malformed exception entries before saving the config

Example fix

// before
"exceptions": [{"account": "prod-account"}]
// 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"`
        Region  string `json:"region"`
    } `json:"exceptions"`
}
json.Unmarshal(cmRaw, &cm)
for i, e := range cm.Exceptions {
    if e.Region == "" { return fmt.Errorf("exception %d missing region", i) }
}

Type guard

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

Try / catch

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

Prevention

When it happens

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

Common situations: Hand-editing exceptions and omitting region; assuming account-only exceptions (e.g. account-wide exemptions) are allowed — the current schema requires region; migration scripts copying partial exception records.

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