{"record":{"id":"ec92e30889dabba5","repo":"argoproj/argo-workflows","slug":"failed-to-parse-clusterworkflowtemplate-w","errorCode":null,"errorMessage":"failed to parse ClusterWorkflowTemplate: %w","messagePattern":"failed to parse ClusterWorkflowTemplate: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/convert.go","lineNumber":124,"sourceCode":"\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\n\t}\n\n\treturn outputObject(converted, outputFormat, isJSON)\n}\n\nfunc outputObject(obj any, format string, preferJSON bool) error {\n\tvar outBytes []byte","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/convert.go#L106-L142","documentation":"During `argo convert`, a YAML document whose kind is ClusterWorkflowTemplate failed to unmarshal into the legacy ClusterWorkflowTemplate struct. The command parses legacy-format manifests into typed structs before migrating them to the current schema; yaml.Unmarshal returned an error for this document. The wrapped inner error describes the exact field/type mismatch or malformed YAML.","triggerScenarios":"Running `argo convert` on a file containing `kind: ClusterWorkflowTemplate` whose YAML does not match the LegacyClusterWorkflowTemplate struct: malformed YAML syntax, wrong types for fields (e.g. string where an int is expected), or invalid values for typed fields (enums, durations, quantities).","commonSituations":"Hand-edited manifests with indentation or type mistakes; manifests exported from other tools with incompatible field types; partially migrated multi-document files mixing old and new schema; YAML containing duplicate keys or unparseable blocks.","solutions":["Read the wrapped error to find the exact field/line, and fix the YAML syntax or field type in the source manifest.","Validate the document with `argo lint` or a YAML parser before converting.","Confirm the manifest is really a ClusterWorkflowTemplate and not a similarly-named kind (kind string must match exactly).","If the file is already in current schema, convert the documents that are actually legacy, or rely on the unknown-kind passthrough by adjusting the kind."],"exampleFix":"// before (manifest with wrong field type)\nspec:\n  templates:\n    - name: main\n      retryStrategy: \"not-a-struct\"\n// after\nspec:\n  templates:\n    - name: main\n      retryStrategy:\n        limit: 3","handlingStrategy":"validation","validationCode":"// lint the manifest before converting\nif err := yaml.Unmarshal(data, &struct{\n  APIVersion string `yaml:\"apiVersion\"`\n  Kind string `yaml:\"kind\"`\n  Spec  map[string]any `yaml:\"spec\"`\n}{}); err != nil {\n  return fmt.Errorf(\"invalid ClusterWorkflowTemplate YAML: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"// in Go, check the wrapped error to locate the failing field\nif err := convertDocument(data, out, isJSON); err != nil {\n  var tErr *yaml.TypeError\n  if errors.As(err, &tErr) {\n    for _, te := range tErr.Errors { log.Printf(\"yaml type error: %s\", te) }\n  }\n  return err\n}","preventionTips":["Run `argo lint` on manifests as a CI check before conversion.","Keep manifests in version control and validate them with a YAML linter.","Avoid hand-editing specs; regenerate from templates."],"tags":["cli","yaml","parsing","conversion"],"backgroundTag":"yaml-unmarshal-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"}