{"record":{"id":"9267918afde3fea5","repo":"argoproj/argo-workflows","slug":"failed-to-unmarshall-config-map-key-q-for-artifac","errorCode":null,"errorMessage":"failed to unmarshall config map key %q for artifact repository ref \"%v\": %w","messagePattern":"failed to unmarshall config map key %q for artifact repository ref \"(.+?)\": %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/artifactrepositories/artifactrepositories.go","lineNumber":103,"sourceCode":"\tvar cm *v1.ConfigMap\n\tnamespace := ref.Namespace\n\tconfigMap := ref.GetConfigMapOr(\"artifact-repositories\")\n\terr := waitutil.Backoff(retry.DefaultRetry(ctx), func() (bool, error) {\n\t\tvar err error\n\t\tcm, err = s.kubernetesInterface.CoreV1().ConfigMaps(namespace).Get(ctx, configMap, metav1.GetOptions{})\n\t\treturn !errorsutil.IsTransientErrQuiet(ctx, err), err\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkey := ref.GetKeyOr(cm.Annotations[\"workflows.argoproj.io/default-artifact-repository\"])\n\tvalue, ok := cm.Data[key]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(`config map missing key \"%s\" for artifact repository ref \"%v\"`, key, ref)\n\t}\n\trepo := &wfv1.ArtifactRepository{}\n\tif err := yaml.Unmarshal([]byte(value), repo); err != nil {\n\t\treturn nil, fmt.Errorf(`failed to unmarshall config map key %q for artifact repository ref \"%v\": %w`, key, ref, err)\n\t}\n\t// we need the fully filled out ref so we can store it in the workflow status and it will never change\n\t// (even if the config map default annotation is changed)\n\t// this means users can change the default\n\treturn &wfv1.ArtifactRepositoryRefStatus{\n\t\tNamespace:             namespace,\n\t\tArtifactRepositoryRef: wfv1.ArtifactRepositoryRef{ConfigMap: configMap, Key: key},\n\t\tArtifactRepository:    repo,\n\t}, nil\n}\n","sourceCodeStart":85,"sourceCodeEnd":114,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/artifactrepositories/artifactrepositories.go#L85-L114","documentation":"The ConfigMap key was found, but its string value failed to unmarshal (sigs.k8s.io/yaml) into a wfv1.ArtifactRepository struct. The wrapped yaml error names the offending field/type. The value must be valid YAML matching the ArtifactRepository schema (e.g. an s3:, gcs:, or other backend block).","triggerScenarios":"s.get unmarshals cm.Data[key] into &wfv1.ArtifactRepository{} and yaml.Unmarshal fails — value is plain text instead of YAML, has wrong types (e.g. bucket as a number/list), unknown incompatible structure, or invalid YAML syntax (tabs, bad indentation).","commonSituations":"Pasting JSON-ish or prose into the ConfigMap entry; using tabs instead of spaces in the YAML; specifying a backend field with the wrong shape (e.g. s3: mybucket instead of a mapping); schema drift after an Argo version upgrade changing field names.","solutions":["Read the wrapped yaml error after the colon to find the exact offending line/field","Fix the key's value to be valid YAML matching ArtifactRepository schema (see docs/fields.md for s3/gcs/azure/oss shapes)","Replace tabs with spaces and validate the YAML (yamllint) before applying the ConfigMap","Check the Argo version's expected schema if fields were renamed in an upgrade"],"exampleFix":"# before (invalid: scalar instead of mapping)\ns3: my-bucket\n# after\ns3:\n  bucket: my-bucket\n  endpoint: s3.amazonaws.com\n  insecure: true","handlingStrategy":"validation","validationCode":"func validArtifactRepoYAML(s string) error {\n    var repo wfv1.ArtifactRepository\n    if err := yaml.Unmarshal([]byte(s), &repo); err != nil {\n        return fmt.Errorf(\"invalid ArtifactRepository YAML: %w\", err)\n    }\n    return nil\n}\n// run for every key in artifact-repositories before the controller uses it","typeGuard":null,"tryCatchPattern":"_, err := repos.Get(ctx, ref)\nif err != nil && strings.Contains(err.Error(), \"failed to unmarshall config map key\") {\n    return fmt.Errorf(\"artifact-repositories ConfigMap value is malformed: %w\", err)\n}","preventionTips":["Validate ConfigMap values with yamllint / a schema check before kubectl apply","Use spaces, never tabs, in embedded YAML values","Match the documented ArtifactRepository schema (s3:/gcs: etc. as mappings, not scalars)","Add a unit/CI test that unmarshals every key of the artifact-repositories ConfigMap"],"tags":["yaml","configmap","artifact-repository","schema-validation"],"backgroundTag":"schema-validation-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"}