Netflix/chaosmonkey · error

%s: unexpected type %T

Error message

%s: unexpected type %T

What it means

Type guard in config.Monkey.getStringSlice: the config value for the key is neither a []interface{} nor a string, so the switch falls to default. Typical culprits are TOML integers/booleans/tables where a list or comma-separated string was expected.

Source

Thrown at config/monkey.go:326

}

// ErrorCounter returns the names of the backend implementions for
// error counters. Intended for monitoring/alerting.
func (m *Monkey) ErrorCounter() string {
	return m.v.GetString(param.ErrorCounter)
}

func (m *Monkey) getStringSlice(key string) ([]string, error) {
	// This could be encoded natively as a list of strings, or as a string that
	// represents a list of strings, so we need to handle both cases
	t := m.v.Get(key)
	if t == nil {
		return nil, fmt.Errorf("%s not specified", param.Accounts)
	}

	switch t := t.(type) {
	default:
		return nil, fmt.Errorf("%s: unexpected type %T", param.Accounts, t)
	case []string: // When set explicitly in code
		return t, nil
	case []interface{}: // When reading from config file
		return toStrings(t)
	case string: // When reading from prana, which uses string encoding
		// Convert to list of strings
		var result []string
		err := json.Unmarshal([]byte(t), &result)
		return result, err
	}
}

// SpinnakerEndpoint returns the spinnaker endpoint
func (m *Monkey) SpinnakerEndpoint() string {
	return m.v.GetString(param.SpinnakerEndpoint)
}

// SpinnakerCertificate retunrs a path to a .p12 file that contains a TLS cert

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Fix the config file so the key holds a TOML array of strings or a single comma-separated string
  2. Use the %T in the message to identify the actual type stored and correct the encoding
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at config/monkey.go:326 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Netflix/chaosmonkey@eaa28fb761 (2026-09-03). Data as JSON: /api/errors/2d59075823bd037d. Report an issue: GitHub.