{"record":{"id":"763ff3f464c3fa95","repo":"argoproj/argo-workflows","slug":"json-unknown-field-s","errorCode":null,"errorMessage":"json: unknown field \"%s\"","messagePattern":"json: unknown field \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/workflow_types.go","lineNumber":678,"sourceCode":"\tvar candidate []map[string]any\n\terr := json.Unmarshal(value, &candidate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Generate a list of all the available JSON fields of the WorkflowStep struct\n\tavailableFields := map[string]bool{}\n\treflectType := reflect.TypeFor[WorkflowStep]()\n\tfor field := range reflectType.Fields() {\n\t\tcleanString := strings.ReplaceAll(field.Tag.Get(\"json\"), \",omitempty\", \"\")\n\t\tavailableFields[cleanString] = true\n\t}\n\n\t// Enforce that no unknown fields are present\n\tfor _, step := range candidate {\n\t\tfor key := range step {\n\t\t\tif _, ok := availableFields[key]; !ok {\n\t\t\t\treturn fmt.Errorf(`json: unknown field \"%s\"`, key)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Finally, attempt to fully unmarshal the struct\n\terr = json.Unmarshal(value, &p.Steps)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (p ParallelSteps) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(p.Steps)\n}\n\nfunc (p ParallelSteps) OpenAPISchemaType() []string {\n\treturn []string{\"array\"}","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/workflow_types.go#L660-L696","documentation":"ParallelSteps (the anonymous list inside a template's `steps`) uses a custom UnmarshalJSON because WorkflowStep is serialized as a bare JSON list. Since the standard strict-decoding unknown-field enforcement does not apply to this custom unmarshaller, it manually checks each key against the fields of WorkflowStep and returns this error for any unrecognized key.","triggerScenarios":"Unmarshalling a Workflow (via kubectl apply, argo submit, or the k8s API) where a step object inside `steps` contains a JSON key that is not a WorkflowStep field, e.g. a typo like `templete` or `nam`.","commonSituations":"Typo in a step field name; using a field from an older/newer spec version that no longer exists; copy-pasting from documentation of a different CRD version.","solutions":["Fix the reported field name to a valid WorkflowStep field (name, template, templateRef, inline, arguments, when, onExit, continueOn, hooks, withItems, withParam, withSequence, etc.)","Check the CRD schema version you are running against; remove fields not present in it","Run `argo lint` locally to catch typos before applying"],"exampleFix":"// before\n- nam: build\n  templete: build-template\n// after\n- name: build\n  template: build-template","handlingStrategy":"validation","validationCode":"var candidate []map[string]any\nif err := json.Unmarshal(stepBytes, &candidate); err != nil {\n    return err\n}\nallowed := map[string]bool{\"name\":true,\"template\":true,\"templateRef\":true,\"inline\":true,\"arguments\":true,\"when\":true,\"onExit\":true,\"continueOn\":true,\"hooks\":true,\"withItems\":true,\"withParam\":true,\"withSequence\":true}\nfor _, step := range candidate {\n    for k := range step {\n        if !allowed[k] {\n            return fmt.Errorf(`unknown field %q in steps`, k)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"err := json.Unmarshal(data, &wf)\nif err != nil {\n    var unknown [1]string\n    if n, _ := fmt.Sscanf(err.Error(), `json: unknown field %q`, &unknown[0]); n == 1 {\n        return fmt.Errorf(\"typo in steps field: %s\", unknown[0])\n    }\n    return err\n}","preventionTips":["Use an editor with the Argo Workflows JSON/YAML schema for autocompletion","Run `argo lint` before applying","Pin and match docs to your installed Argo version"],"tags":["json","unmarshal","strict-decoding","yaml"],"backgroundTag":"unknown-json-field","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"}