argoproj/argo-workflows · error

failed to parse CronWorkflow: %w

Error message

failed to parse CronWorkflow: %w

What it means

When the document's kind is CronWorkflow, convertDocument unmarshals the whole document into convert.LegacyCronWorkflow to migrate singular schedule/mutex/semaphore fields to their plural forms. If that typed unmarshal fails, this error wraps the YAML error (usually a type mismatch or strict field-type problem).

Source

Thrown at cmd/argo/commands/convert.go:103

	}
	return nil
}

func convertDocument(data []byte, outputFormat string, isJSON bool) error {
	// First, determine the kind
	var typeMeta metav1.TypeMeta
	if err := yaml.Unmarshal(data, &typeMeta); err != nil {
		return fmt.Errorf("failed to parse TypeMeta: %w", err)
	}

	var converted any

	// Parse into legacy type and convert to current type
	switch typeMeta.Kind {
	case wf.CronWorkflowKind:
		var legacy convert.LegacyCronWorkflow
		if err := yaml.Unmarshal(data, &legacy); err != nil {
			return fmt.Errorf("failed to parse CronWorkflow: %w", err)
		}
		converted = legacy.ToCurrent()

	case wf.WorkflowKind:
		var legacy convert.LegacyWorkflow
		if err := yaml.Unmarshal(data, &legacy); err != nil {
			return fmt.Errorf("failed to parse Workflow: %w", err)
		}
		converted = legacy.ToCurrent()

	case wf.WorkflowTemplateKind:
		var legacy convert.LegacyWorkflowTemplate
		if err := yaml.Unmarshal(data, &legacy); err != nil {
			return fmt.Errorf("failed to parse WorkflowTemplate: %w", err)
		}
		converted = legacy.ToCurrent()

	case wf.ClusterWorkflowTemplateKind:

View on GitHub (pinned to 35bff19146)

Solutions

  1. Fix the field type named in the wrapped error (e.g. schedule must be a string for the legacy shape)
  2. Validate the CronWorkflow with `argo lint` for schema-level detail
  3. Run `argo convert` with `-o json` to inspect output after fixing, or re-generate the manifest from the current schema
  4. If the doc already uses plural fields and is current, it may not need conversion — verify kind/apiVersion are exactly argoproj.io/v1alpha1 CronWorkflow

Example fix

// before
schedule:
  - "0 0 * * *"
// after
schedule: "0 0 * * *"
Defensive patterns

Strategy: validation

Validate before calling

yq -e 'select(.kind == "CronWorkflow") | .spec.schedule | type == "string"' file.yaml \
  || echo 'schedule must be a string'

Try / catch

if ! argo convert "$f" 2>err; then
  grep 'failed to parse CronWorkflow' err && echo 'fix field types in CronWorkflow spec'
fi

Prevention

When it happens

Trigger: `argo convert` on a CronWorkflow manifest where a field's type doesn't match the legacy struct — e.g. `schedule` as a list instead of string, `startingSeconds`/`concurrencyPolicy` with wrong types, or malformed nested schedules/mutexes structures.

Common situations: Hand-migrated CronWorkflows from other tools with divergent field types; YAML anchors/aliases resolving to unexpected types; partially migrated manifests mixing legacy and plural fields with incompatible shapes.

Understand the failure class

Related errors


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