argoproj/argo-workflows · error

${e.Usage()}

Error message

${e.Usage()}

What it means

Returned by EnumFlagValue.Set when the user passes a CLI flag value that is not one of the enum's AllowedValues (e.g. --output for get/list commands). The text of the error is the generated usage line listing the allowed choices.

Solutions

  1. Read the usage text in the error and pick one of the listed allowed values.
  2. Fix casing/typos (values are matched exactly).
  3. Run argo <cmd> --help to see the current accepted values for your version.

Example fix

// before
argo list --output yamlx
// after
argo list --output yaml
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED=("json" "yaml" "wide" "name")
if [[ ! " ${ALLOWED[*]} " == *" $FMT "* ]]; then echo "bad --output: $FMT"; exit 1; fi

Try / catch

out=$(argo list --output "$FMT" 2>&1) || {
  echo "$out" # usage text lists allowed values
}

Prevention

When it happens

Trigger: Passing a value not in the enum to any flag backed by EnumFlagValue, e.g. --logformat with a typo, or an invalid --gloglevel, or unknown output format.

Common situations: Typos like --output yamlx; case mismatches (JSON vs json); deprecated values removed in newer CLI versions; scripts carrying flags from older releases.

Understand the failure class

Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/4d00514caeb73fff. Report an issue: GitHub.

Appendix: source

Thrown at cmd/argo/commands/common/flags.go:33

type EnumFlagValue struct {
	AllowedValues []string
	Value         string
}

func (e *EnumFlagValue) Usage() string {
	return fmt.Sprintf("One of: %s", strings.Join(e.AllowedValues, "|"))
}

func (e *EnumFlagValue) String() string {
	return e.Value
}

func (e *EnumFlagValue) Set(v string) error {
	if slices.Contains(e.AllowedValues, v) {
		e.Value = v
		return nil
	}
	return errors.New(e.Usage())
}

func (e *EnumFlagValue) Type() string {
	return "string"
}

var _ pflag.Value = &EnumFlagValue{}

func NewPrintWorkflowOutputValue(value string) EnumFlagValue {
	return EnumFlagValue{
		AllowedValues: []string{"name", "json", "yaml", "wide"},
		Value:         value,
	}
}

View on GitHub (pinned to 35bff19146)