argoproj/argo-workflows · error

config map missing key "%s" for artifact repository ref "%v"

Error message

config map missing key "%s" for artifact repository ref "%v"

What it means

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.

Source

Thrown at workflow/artifactrepositories/artifactrepositories.go:99

			Default:               true,
			ArtifactRepository:    s.defaultArtifactRepository,
		}, nil
	}
	var cm *v1.ConfigMap
	namespace := ref.Namespace
	configMap := ref.GetConfigMapOr("artifact-repositories")
	err := waitutil.Backoff(retry.DefaultRetry(ctx), func() (bool, error) {
		var err error
		cm, err = s.kubernetesInterface.CoreV1().ConfigMaps(namespace).Get(ctx, configMap, metav1.GetOptions{})
		return !errorsutil.IsTransientErrQuiet(ctx, err), err
	})
	if err != nil {
		return nil, err
	}
	key := ref.GetKeyOr(cm.Annotations["workflows.argoproj.io/default-artifact-repository"])
	value, ok := cm.Data[key]
	if !ok {
		return nil, fmt.Errorf(`config map missing key "%s" for artifact repository ref "%v"`, key, ref)
	}
	repo := &wfv1.ArtifactRepository{}
	if err := yaml.Unmarshal([]byte(value), repo); err != nil {
		return nil, fmt.Errorf(`failed to unmarshall config map key %q for artifact repository ref "%v": %w`, key, ref, err)
	}
	// we need the fully filled out ref so we can store it in the workflow status and it will never change
	// (even if the config map default annotation is changed)
	// this means users can change the default
	return &wfv1.ArtifactRepositoryRefStatus{
		Namespace:             namespace,
		ArtifactRepositoryRef: wfv1.ArtifactRepositoryRef{ConfigMap: configMap, Key: key},
		ArtifactRepository:    repo,
	}, nil
}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Add the missing key to the ConfigMap data with a valid ArtifactRepository YAML value
  2. Update the workflow's artifactRepositoryRef key (or the default-artifact-repository annotation) to an existing key
  3. Check kubectl get configmap artifact-repositories -o yaml to list available keys and pick/reconcile accordingly
  4. 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

Example fix

# before
metadata:
  annotations:
    workflows.argoproj.io/default-artifact-repository: s3
data:
  gcs: |
    gcs: {bucket: b}
# after: key matches annotation
metadata:
  annotations:
    workflows.argoproj.io/default-artifact-repository: gcs
data:
  gcs: |
    gcs: {bucket: b}
Defensive patterns

Strategy: validation

Validate before calling

func keyExists(cm *corev1.ConfigMap, refKey string) error {
    key := refKey
    if key == "" { key = cm.Annotations["workflows.argoproj.io/default-artifact-repository"] }
    if _, ok := cm.Data[key]; !ok {
        keys := make([]string, 0, len(cm.Data))
        for k := range cm.Data { keys = append(keys, k) }
        return fmt.Errorf("key %q missing; available: %v", key, keys)
    }
    return nil
}

Try / catch

_, err := repos.Get(ctx, ref)
if err != nil && strings.Contains(err.Error(), "config map missing key") {
    return fmt.Errorf("artifact repository misconfiguration: %w — fix the ConfigMap key or annotation", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/c04309c1b9bba811. Report an issue: GitHub.