{"record":{"id":"99dbe9bfbce50366","repo":"argoproj/argo-workflows","slug":"cannot-unmarshal-type-t","errorCode":null,"errorMessage":"cannot unmarshal type %T","messagePattern":"cannot unmarshal type %T","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/marshall.go","lineNumber":41,"sourceCode":"\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)\n\treturn x\n}\n\nfunc MustUnmarshalCronWorkflow(text any) *CronWorkflow {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/marshall.go#L23-L59","documentation":"MustUnmarshal accepts only byte slices and strings (optionally prefixed with '@file', '{' for JSON); any other Go type passed as text reaches this panic in the default branch. It is a programmer-error guard for callers of MustUnmarshal (e.g. template expression handling) that pass an unsupported type such as an int or a struct; it panics rather than returning an error.","triggerScenarios":"Thrown at pkg/apis/workflow/v1alpha1/marshall.go:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a string or []byte to MustUnmarshal","Convert the value (e.g. fmt.Sprint) before calling"],"exampleFix":null,"handlingStrategy":"type-guard","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"}