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
- Fix the field type named in the wrapped error (e.g. schedule must be a string for the legacy shape)
- Validate the CronWorkflow with `argo lint` for schema-level detail
- Run `argo convert` with `-o json` to inspect output after fixing, or re-generate the manifest from the current schema
- 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
- Keep schedule as a single string; put extra schedules in the plural schedules field
- Validate with `argo lint` before converting
- Avoid YAML anchors that resolve to lists where scalars are expected
- After upstream upgrades, re-lint legacy manifests before converting
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
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- failed to parse TypeMeta: %w
- failed to parse Workflow: %w
- failed to parse WorkflowTemplate: %w
- no workflow found in given files
- unknown output mode: %s
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/273203c3093c6d98.
Report an issue: GitHub.