argoproj/argo-workflows · error

expected Annotations of the form: NAME1=VALUE2,NAME2=VALUE2.

Error message

expected Annotations of the form: NAME1=VALUE2,NAME2=VALUE2. Received: %s: %w

What it means

ApplySubmitOpts parses opts.Annotations with cmdutil.ParseLabels (same NAME=VALUE,NAME=VALUE syntax as labels). If parsing fails, the error is wrapped as 'expected Annotations of the form...'. Note the message interpolates opts.Labels instead of opts.Annotations — a small upstream bug, but the trigger is malformed opts.Annotations.

Source

Thrown at workflow/util/util.go:287

	if wfLabels == nil {
		wfLabels = make(map[string]string)
	}
	if opts.Labels != "" {
		passedLabels, err := cmdutil.ParseLabels(opts.Labels)
		if err != nil {
			return fmt.Errorf("expected labels of the form: NAME1=VALUE2,NAME2=VALUE2. Received: %s: %w", opts.Labels, err)
		}
		maps.Copy(wfLabels, passedLabels)
	}
	wf.SetLabels(wfLabels)
	wfAnnotations := wf.GetAnnotations()
	if wfAnnotations == nil {
		wfAnnotations = make(map[string]string)
	}
	if opts.Annotations != "" {
		passedAnnotations, err := cmdutil.ParseLabels(opts.Annotations)
		if err != nil {
			return fmt.Errorf("expected Annotations of the form: NAME1=VALUE2,NAME2=VALUE2. Received: %s: %w", opts.Labels, err)
		}
		maps.Copy(wfAnnotations, passedAnnotations)
	}
	wf.SetAnnotations(wfAnnotations)
	err := overrideParameters(wf, opts.Parameters)
	if err != nil {
		return err
	}
	err = overrideArtifacts(wf, opts.Artifacts)
	if err != nil {
		return err
	}
	if opts.GenerateName != "" {
		wf.GenerateName = opts.GenerateName
	}
	if opts.Name != "" {
		wf.Name = opts.Name
	}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Format annotations as comma-separated KEY=VALUE pairs and quote them: --annotations "owner=team,slot=priority"
  2. Verify each pair contains '=' and uses valid Kubernetes annotation keys/values
  3. If the error message shows the wrong input (your labels instead of annotations), be aware of the known message bug in workflow/util/util.go:287 — fix your --annotations value, not your --labels

Example fix

// before
argo submit wf.yaml --annotations owner: team
// after
argo submit wf.yaml --annotations "owner=team"
Defensive patterns

Strategy: validation

Validate before calling

for _, pair := range strings.Split(annotationsArg, ",") {
    if !strings.Contains(pair, "=") || strings.SplitN(pair, "=", 2)[0] == "" {
        return fmt.Errorf("invalid annotation pair %q; use NAME=VALUE,NAME=VALUE", pair)
    }
}

Try / catch

err := util.ApplySubmitOpts(wf, opts)
if err != nil && strings.Contains(err.Error(), "expected Annotations of the form") {
    // note: message may show opts.Labels due to upstream bug — inspect --annotations
    return fmt.Errorf("fix --annotations flag (KEY=VALUE,KEY=VALUE): %w", err)
}

Prevention

When it happens

Trigger: argo submit --annotations with a malformed value (missing '=', invalid characters) — ParseLabels returns an error which is wrapped with this message while passing opts.Labels into the message text.

Common situations: Unquoted comma/space-separated annotations in shell; missing '=' in a pair; copying YAML-style annotations (key: value) into the flag; confusion because the error text shows the labels value.

Related errors


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