{"record":{"id":"c04309c1b9bba811","repo":"argoproj/argo-workflows","slug":"config-map-missing-key-s-for-artifact-repositor","errorCode":null,"errorMessage":"config map missing key \"%s\" for artifact repository ref \"%v\"","messagePattern":"config map missing key \"(.+?)\" for artifact repository ref \"(.+?)\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/artifactrepositories/artifactrepositories.go","lineNumber":99,"sourceCode":"\t\t\tDefault:               true,\n\t\t\tArtifactRepository:    s.defaultArtifactRepository,\n\t\t}, nil\n\t}\n\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":81,"sourceCodeEnd":114,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/artifactrepositories/artifactrepositories.go#L81-L114","documentation":"The referenced artifact-repositories ConfigMap exists, but the required key is absent from its data. The key comes from the ref's explicit key or the ConfigMap's workflows.argoproj.io/default-artifact-repository annotation. Resolve treats this as 'candidate not applicable' and tries the next ref; Get surfaces it directly.","triggerScenarios":"s.get finds ConfigMap 'artifact-repositories' (or a custom ref name) but cm.Data has no entry for ref.GetKeyOr(annotation) — e.g. workflow uses artifactRepositoryRef: {key: s3} but the ConfigMap only has a 'gcs' entry, or the default-artifact-repository annotation names a key that was deleted/renamed.","commonSituations":"Renaming keys in the ConfigMap without updating workflows or the annotation; multi-tenant setups where the workflow expects a per-namespace key that doesn't exist; typo in the ref key; ConfigMap created from an older template missing the new key.","solutions":["Add the missing key to the ConfigMap data with a valid ArtifactRepository YAML value","Update the workflow's artifactRepositoryRef key (or the default-artifact-repository annotation) to an existing key","Check kubectl get configmap artifact-repositories -o yaml to list available keys and pick/reconcile accordingly","If Resolve produced this, fix the first candidate (workflow namespace) or accept that the next ref was tried — inspect the final 'failed to find any artifact repository' error"],"exampleFix":"# before\nmetadata:\n  annotations:\n    workflows.argoproj.io/default-artifact-repository: s3\ndata:\n  gcs: |\n    gcs: {bucket: b}\n# after: key matches annotation\nmetadata:\n  annotations:\n    workflows.argoproj.io/default-artifact-repository: gcs\ndata:\n  gcs: |\n    gcs: {bucket: b}","handlingStrategy":"validation","validationCode":"func keyExists(cm *corev1.ConfigMap, refKey string) error {\n    key := refKey\n    if key == \"\" { key = cm.Annotations[\"workflows.argoproj.io/default-artifact-repository\"] }\n    if _, ok := cm.Data[key]; !ok {\n        keys := make([]string, 0, len(cm.Data))\n        for k := range cm.Data { keys = append(keys, k) }\n        return fmt.Errorf(\"key %q missing; available: %v\", key, keys)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"_, err := repos.Get(ctx, ref)\nif err != nil && strings.Contains(err.Error(), \"config map missing key\") {\n    return fmt.Errorf(\"artifact repository misconfiguration: %w — fix the ConfigMap key or annotation\", err)\n}","preventionTips":["List ConfigMap keys (kubectl get cm artifact-repositories -o yaml) before referencing one by key","Use CI to lint artifactRepositoryRef keys against the deployed ConfigMap","Never rename/remove keys without updating workflows and the annotation","Keep one canonical key (e.g. the annotation target) present in every environment"],"tags":["kubernetes","configmap","artifact-repository","missing-key"],"backgroundTag":"configmap-key-missing","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"}