GoogleContainerTools/skaffold · error

value must be one of `always`, `missing`, or `never`

Error message

value must be one of `always`, `missing`, or `never`

What it means

SyncRemoteCacheOption implements pflag's Value interface; its Set method only accepts the literals `always`, `missing`, or `never` (which control remote base-image cache sync behavior). Any other string passed to the corresponding flag fails flag parsing with this error.

Source

Thrown at pkg/skaffold/config/remote_cache.go:59

type SyncRemoteCacheOption struct {
	value string
}

func (s *SyncRemoteCacheOption) Type() string {
	return "string"
}

func (s *SyncRemoteCacheOption) Value() string {
	return s.value
}

func (s *SyncRemoteCacheOption) Set(v string) error {
	switch v {
	case always, missing, never:
		s.value = v
		return nil
	default:
		return errors.New("value must be one of `always`, `missing`, or `never`")
	}
}

func (s *SyncRemoteCacheOption) SetNil() error {
	s.value = always
	return nil
}

func (s *SyncRemoteCacheOption) String() string {
	if s.value == "" {
		return always
	}
	return s.value
}

// CloneDisabled specifies if cloning remote dependencies is disabled by flag value
func (s *SyncRemoteCacheOption) CloneDisabled() bool {
	return s.value == never

View on GitHub (pinned to a1189de023)

Solutions

  1. Use one of the exact accepted values: `--sync-remote-cache=always`, `=missing`, or `=never`
  2. Correct casing to lowercase (`Always` -> `always`)
  3. Replace boolean-style values: `true` -> `always`, `false` -> `never`

Example fix

// before
skaffold dev --sync-remote-cache=true
// after
skaffold dev --sync-remote-cache=always
Defensive patterns

Strategy: validation

Validate before calling

case "$SYNC_MODE" in
  always|missing|never) ;;
  *) echo "SYNC_MODE must be always|missing|never"; exit 1;;
esac
skaffold dev --sync-remote-cache="$SYNC_MODE"

Type guard

const valid = ['always', 'missing', 'never'];
const isValidSyncRemoteCache = (v) => valid.includes(v);

Try / catch

if err := opt.Set(v); err != nil {
  if strings.Contains(err.Error(), "value must be one of") {
    return fmt.Errorf("--sync-remote-cache: %q is invalid; use always, missing, or never", v)
  }
  return err
}

Prevention

When it happens

Trigger: Passing an invalid value to the sync remote cache flag, e.g. `--sync-remote-cache=Always`, `true`, `yes`, or a typo like `alway`. Matching is exact lowercase.

Common situations: Users assuming boolean semantics and passing `true`/`false`; capitalization mistakes; copying flag values from older skaffold docs with different accepted values.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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