argoproj/argo-workflows · error
failed to set key for artifact %s: %w
Error message
failed to set key for artifact %s: %w
What it means
ApplyOverridesToTemplateArtifacts rewrites artifact keys on template artifacts being submitted. This error wraps the failure of ArtifactLocation.SetKey for a matched artifact. SetKey delegates to the concrete artifact type; types like Git and Raw do not support key rewriting and return 'key unsupported', and HTTP/Artifactory URL parsing failures also surface here.
Source
Thrown at workflow/util/util.go:373
// ApplyOverridesToTemplateArtifacts returns a deep copy of each artifact in templateArtifacts
// whose name has an entry in overrides, with its key set to the override value. Artifacts
// without a matching override are omitted from the result. Every override must match a
// template artifact; an override naming an unknown artifact is an error rather than a silent
// no-op, so a typo'd or stale override does not run the workflow with default settings after
// the caller was told the upload succeeded. This is a pure function: it does not resolve
// artifact repositories or mutate its inputs.
func ApplyOverridesToTemplateArtifacts(templateArtifacts []wfv1.Artifact, overrides map[string]string) ([]wfv1.Artifact, error) {
applied := make([]wfv1.Artifact, 0, len(overrides))
consumed := make(map[string]bool, len(overrides))
for _, tmplArt := range templateArtifacts {
newKey, ok := overrides[tmplArt.Name]
if !ok {
continue
}
consumed[tmplArt.Name] = true
artCopy := tmplArt.DeepCopy()
if err := artCopy.SetKey(newKey); err != nil {
return nil, fmt.Errorf("failed to set key for artifact %s: %w", tmplArt.Name, err)
}
applied = append(applied, *artCopy)
}
if err := unmatchedOverridesError(overrides, consumed); err != nil {
return nil, err
}
return applied, nil
}
// unmatchedOverridesError names any override whose artifact name matched no artifact, so a
// typo'd or stale override surfaces as an error instead of being silently dropped. Returns
// nil when every override was consumed.
func unmatchedOverridesError(overrides map[string]string, consumed map[string]bool) error {
unmatched := make([]string, 0)
for name := range overrides {
if !consumed[name] {
unmatched = append(unmatched, name)
}View on GitHub (pinned to 35bff19146)
Solutions
- Remove the override for that artifact, or change the artifact's source type to a key-addressed backend (s3, gcs, oss, azure, hdfs, http, artifactory, plugin).
- For git artifacts, change the revision via the git 'revision' field in the template instead of an artifact key override.
- For raw artifacts, supply the inline content directly rather than overriding a key.
- If HTTP/Artifactory, verify the URL is a valid absolute URL so url.Parse succeeds.
Example fix
// before
artifacts:
- name: src
git:
repo: https://github.com/x/y
// after (key-addressed backend that supports SetKey)
artifacts:
- name: src
s3:
key: path/in/bucket Defensive patterns
Strategy: validation
Validate before calling
for _, art := range templateArtifacts {
if overrides[art.Name] == "" {
continue
}
if art.HasLocation() && (art.Git != nil || art.Raw != nil) {
return fmt.Errorf("artifact %q (%s) does not support key overrides", art.Name, art.ArtifactLocation.GetType())
}
} Type guard
func supportsSetKey(a wfv1.Artifact) bool {
return a.S3 != nil || a.GCS != nil || a.OSS != nil || a.Azure != nil ||
a.HDFS != nil || a.HTTP != nil || a.Artifactory != nil || a.Plugin != nil
} Try / catch
applied, err := util.ApplyOverridesToTemplateArtifacts(tmplArts, overrides)
if err != nil {
var keyErr *fmt.Errorf // inspect wrapped 'key unsupported' error
return fmt.Errorf("artifact override rejected: %w", err)
} Prevention
- Only override key-addressed artifact types (s3/gcs/oss/azure/hdfs/http/artifactory/plugin).
- Set git revisions via the git revision field, not key overrides.
- Check artifact URLs are valid before submission.
When it happens
Trigger: Submitting a workflow whose template artifact has a GitArtifact or RawArtifact source and passing an --artifact override (NAME=KEY) for it; or an HTTP/Artifactory artifact whose URL fails url.Parse.
Common situations: Users assuming every artifact type supports key overriding — git repos and raw inline artifacts cannot have their key set; only S3, GCS, OSS, Azure, HDFS, HTTP, Artifactory, and plugin artifacts can.
Related errors
- failed to set key for artifact %s in stored spec: %w
- set type not supported for type: %v
- artifact override(s) matched no artifact: %s
- no artifact logs are available
- Artifact driver connection validation failed: %v
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/67a89c6bf9585603.
Report an issue: GitHub.