{"record":{"id":"6e5485fdec0b9ba8","repo":"argoproj/argo-workflows","slug":"failed-to-unmarshal-yaml-q-w","errorCode":null,"errorMessage":"failed to unmarshal YAML %q: %w","messagePattern":"failed to unmarshal YAML %q: %w","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/marshall.go","lineNumber":37,"sourceCode":"\tcase []byte:\n\t\tif len(x) == 0 {\n\t\t\tpanic(\"no text to unmarshal\")\n\t\t}\n\t\tswitch x[0] {\n\t\tcase '@':\n\t\t\tfilename := string(x[1:])\n\t\t\ty, err := os.ReadFile(filepath.Clean(filename))\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Errorf(\"failed to read file %s: %w\", filename, err))\n\t\t\t}\n\t\t\tMustUnmarshal(y, v)\n\t\tcase '{':\n\t\t\tif err := json.Unmarshal(x, v); err != nil {\n\t\t\t\tpanic(fmt.Errorf(\"failed to unmarshal JSON %q: %w\", string(x), err))\n\t\t\t}\n\t\tdefault:\n\t\t\tif err := yaml.UnmarshalStrict(x, v); err != nil {\n\t\t\t\tpanic(fmt.Errorf(\"failed to unmarshal YAML %q: %w\", string(x), err))\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tpanic(fmt.Errorf(\"cannot unmarshal type %T\", text))\n\t}\n}\n\nfunc MustMarshallJSON(v any) string {\n\tdata, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(data)\n}\n\nfunc MustUnmarshalClusterWorkflowTemplate(text any) *ClusterWorkflowTemplate {\n\tx := &ClusterWorkflowTemplate{}\n\tMustUnmarshal(text, &x)","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/marshall.go#L19-L55","documentation":"MustUnmarshal fell through to YAML parsing (input not '@' or '{') and yaml.UnmarshalStrict rejected the document — strict mode fails on unknown or duplicate fields. The panic message embeds the offending text.","triggerScenarios":"Thrown at pkg/apis/workflow/v1alpha1/marshall.go:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove unknown/mistyped fields from the YAML","Check for duplicate keys, which strict unmarshalling rejects"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}