GoogleContainerTools/skaffold · error

%q is not a valid config field.\nAvailable fields are: %s

Error message

%q is not a valid config field.\nAvailable fields are: %s

What it means

Fires when the user runs `skaffold config set` with a field name that does not match any yaml tag of the config struct's fields. getFieldIndex walks the struct's reflect type fields comparing their yaml tags to the requested name; after exhausting all fields without a match, it rejects the operation. This is a generic validation guard, and the faulting input is the unsupported field name supplied on the command line — the user must pick one of the listed valid fields.

Source

Thrown at cmd/skaffold/app/cmd/config/set.go:99

	if err != nil {
		return nil, nil, err
	}

	allConfigFields := make(map[string]bool)
	for i := 0; i < cs.value.NumField(); i++ {
		fieldType := cs.rType.Field(i)
		for _, tag := range strings.Split(fieldType.Tag.Get("yaml"), ",") {
			allConfigFields[tag] = true
			if tag == name {
				if f, ok := cs.rType.FieldByName(fieldType.Name); ok {
					return append(cs.idx, f.Index...), valI, nil
				}
				return nil, valI, fmt.Errorf("could not find config field %s", name)
			}
		}
	}

	return nil, nil, fmt.Errorf(
		"%q is not a valid config field.\nAvailable fields are: %s",
		name,
		strings.Join(slices.Collect(maps.Keys(allConfigFields)), ", "),
	)
}

func getValueInterface(cfg *config.ContextConfig, value string) interface{} {
	if !isUserSurvey() {
		return value
	}
	if cfg.Survey == nil {
		cfg.Survey = &config.SurveyConfig{}
	}
	if cfg.Survey.UserSurveys == nil {
		cfg.Survey.UserSurveys = []*config.UserSurvey{}
	}
	return cfg.Survey.UserSurveys
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Pick one of the field names listed in the error message
  2. Run `skaffold config list` to see the available fields and their current values
  3. Check for typos and case differences in the field name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/skaffold/app/cmd/config/set.go:99 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/08ba84fd5a4e793e. Report an issue: GitHub.