{"record":{"id":"40aa53b260274917","repo":"argoproj/argo-workflows","slug":"failed-to-parse-workflowtemplate-w","errorCode":null,"errorMessage":"failed to parse WorkflowTemplate: %w","messagePattern":"failed to parse WorkflowTemplate: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/convert.go","lineNumber":117,"sourceCode":"\tswitch typeMeta.Kind {\n\tcase wf.CronWorkflowKind:\n\t\tvar legacy convert.LegacyCronWorkflow\n\t\tif err := yaml.Unmarshal(data, &legacy); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse CronWorkflow: %w\", err)\n\t\t}\n\t\tconverted = legacy.ToCurrent()\n\n\tcase wf.WorkflowKind:\n\t\tvar legacy convert.LegacyWorkflow\n\t\tif err := yaml.Unmarshal(data, &legacy); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse Workflow: %w\", err)\n\t\t}\n\t\tconverted = legacy.ToCurrent()\n\n\tcase wf.WorkflowTemplateKind:\n\t\tvar legacy convert.LegacyWorkflowTemplate\n\t\tif err := yaml.Unmarshal(data, &legacy); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse WorkflowTemplate: %w\", err)\n\t\t}\n\t\tconverted = legacy.ToCurrent()\n\n\tcase wf.ClusterWorkflowTemplateKind:\n\t\tvar legacy convert.LegacyClusterWorkflowTemplate\n\t\tif err := yaml.Unmarshal(data, &legacy); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse ClusterWorkflowTemplate: %w\", err)\n\t\t}\n\t\tconverted = legacy.ToCurrent()\n\n\tdefault:\n\t\t// Unknown type - pass through unchanged\n\t\t// Re-parse as generic map to preserve structure\n\t\tvar generic map[string]any\n\t\tif err := yaml.Unmarshal(data, &generic); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse unknown kind %s: %w\", typeMeta.Kind, err)\n\t\t}\n\t\tconverted = generic","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/convert.go#L99-L135","documentation":"When the document's kind is WorkflowTemplate, convertDocument unmarshals into convert.LegacyWorkflowTemplate to migrate singular mutex/semaphore fields to plural. A typed-unmarshal failure yields this error with the underlying yaml reason wrapped.","triggerScenarios":"`argo convert` on a WorkflowTemplate whose body mismatches the legacy struct — e.g. `templates` not a list, `arguments`/`parameters` with wrong value types, or a WorkflowTemplate body accidentally holding CronWorkflow fields.","commonSituations":"Templates refactored by copy-paste between kinds (CronWorkflow fields left inside a WorkflowTemplate); Helm/Kustomize patches injecting wrong types; multi-doc manifests where a kind header was edited but the body was not.","solutions":["Fix the field named in the wrapped yaml error (expected type vs actual)","Run `argo lint` to validate the WorkflowTemplate schema independently of conversion","Confirm apiVersion/kind match the body contents (kind: WorkflowTemplate with Workflow-shaped body will fail)","Convert the file document-by-document if it is multi-doc to isolate the failing template"],"exampleFix":"// before (copy-paste mistake)\nkind: WorkflowTemplate\nspec:\n  schedule: \"0 0 * * *\"\n// after\nkind: WorkflowTemplate\nspec:\n  templates: []","handlingStrategy":"validation","validationCode":"yq -e 'select(.kind == \"WorkflowTemplate\") | .spec.templates | type == \"seq\"' file.yaml \\\n  || echo 'WorkflowTemplate spec.templates must be a list'","typeGuard":null,"tryCatchPattern":"if ! argo convert \"$f\" 2>err; then\n  grep 'failed to parse WorkflowTemplate' err && echo 'verify kind matches body shape and field types'\nfi","preventionTips":["Never copy CronWorkflow fields into WorkflowTemplate bodies","Validate with `argo lint` before conversion","Keep one kind per file to avoid kind/body drift after edits","Run conversions in CI so type drift is caught at review time"],"tags":["cli","yaml","workflow-template","argoproj"],"backgroundTag":"manifest-parse-failed","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}