Netflix/chaosmonkey · error

could not retrieve list of apps: %v

Error message

could not retrieve list of apps: %v

What it means

Populate() needs the list of app names when the caller did not pass any explicitly. It calls d.AppNames(); if that lookup fails the error is wrapped with this message and Populate aborts, so no chaos monkey schedule entries are populated.

Source

Thrown at schedule/schedule.go:45

	"github.com/Netflix/chaosmonkey/v2"
	"github.com/Netflix/chaosmonkey/v2/config"
	"github.com/Netflix/chaosmonkey/v2/deploy"
	"github.com/Netflix/chaosmonkey/v2/grp"
)

// Populate populates the termination schedule with the random
// terminations for a list of apps. If the specified list of apps is empty,
// then it will
func (s *Schedule) Populate(d deploy.Deployment, getter chaosmonkey.AppConfigGetter, chaosConfig *config.Monkey, apps []string) error {
	c := make(chan *deploy.App)

	// If the caller explicitly a set of apps, use those
	// If they did not, do all apps
	if len(apps) == 0 {
		var err error
		apps, err = d.AppNames()
		if err != nil {
			return fmt.Errorf("could not retrieve list of apps: %v", err)
		}
	}

	go d.Apps(c, apps)
	i := 0 // number of apps already processed
	for app := range c {
		if i >= chaosConfig.MaxApps() {
			break
		}

		i++

		cfg, err := getter.Get(app.Name())

		if err != nil {
			log.Printf("WARNING: Could not retrieve config for app=%s. %s", app.Name(), err)
			continue
		}

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Inspect the wrapped %v inner error to find the root cause (auth, DNS, HTTP status)
  2. Verify Spinnaker endpoint/credentials configuration used by AppNames
  3. Check network connectivity to the app source API
  4. Retry; transient upstream failures resolve on the next scheduler run

Example fix

// before
apps, err = d.AppNames()
if err != nil {
    return fmt.Errorf("could not retrieve list of apps: %v", err)
}
// after
apps, err = d.AppNames()
if err != nil {
    log.Printf("AppNames failed: %v; falling back to explicit list", err)
    return fmt.Errorf("could not retrieve list of apps: %w", err) // preserve chain
}
Defensive patterns

Strategy: try-catch

Validate before calling

if len(apps) == 0 {
    // ensure the app source (Spinnaker) endpoint and credentials are configured
    if cfg.SpinnakerEndpoint() == "" {
        return fmt.Errorf("no apps provided and spinnaker endpoint not configured")
    }
}

Try / catch

if err := sched.Populate(ctx, nil); err != nil {
    var appErr interface{ Unwrap() error }
    if errors.As(err, &appErr) { log.Printf("root cause: %v", errors.Unwrap(err)) }
    // fall back to a cached app list or retry later
}

Prevention

When it happens

Trigger: Calling Populate with an empty apps slice while the underlying AppNames() call (typically backed by Spinnaker or a configured app source) returns an error such as auth failure or unreachable API.

Common situations: Spinnaker endpoint misconfigured, expired credentials, network outage, or the app-list API returning 5xx during scheduling.

Related errors


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