argoproj/argo-workflows · error
failed to set key for artifact %s in stored spec: %w
Error message
failed to set key for artifact %s in stored spec: %w
What it means
overrideArtifacts also re-keys artifacts inside wf.Status.StoredWorkflowSpec (present when the workflow was created from a WorkflowTemplate, i.e. cluster-resolved spec). When SetKey fails there, the error is wrapped with the 'in stored spec' suffix. Same root causes: artifact types that don't support key overrides (git, raw) and invalid HTTP/Artifactory URLs.
Source
Thrown at workflow/util/util.go:429
// Note: For workflowTemplateRef workflows, artifacts are handled in workflow_server.go
// which has access to the WorkflowTemplate to copy the full artifact configuration
consumed := make(map[string]bool, len(overrides))
for i, artifact := range wf.Spec.Arguments.Artifacts {
if newKey, ok := overrides[artifact.Name]; ok {
consumed[artifact.Name] = true
if err := wf.Spec.Arguments.Artifacts[i].SetKey(newKey); err != nil {
return fmt.Errorf("failed to set key for artifact %s: %w", artifact.Name, err)
}
}
}
// Also update StoredWorkflowSpec if present
if wf.Status.StoredWorkflowSpec != nil {
for i, artifact := range wf.Status.StoredWorkflowSpec.Arguments.Artifacts {
if newKey, ok := overrides[artifact.Name]; ok {
consumed[artifact.Name] = true
if err := wf.Status.StoredWorkflowSpec.Arguments.Artifacts[i].SetKey(newKey); err != nil {
return fmt.Errorf("failed to set key for artifact %s in stored spec: %w", artifact.Name, err)
}
}
}
}
// For workflowTemplateRef workflows the artifacts live in the template, not here, so
// unmatched overrides are expected and are validated on the templateRef path instead
// (ApplyOverridesToTemplateArtifacts). Only flag unmatched overrides when this workflow
// is the authority for its own artifacts.
if wf.Spec.WorkflowTemplateRef == nil {
return unmatchedOverridesError(overrides, consumed)
}
return nil
}
func ReadParametersFile(ctx context.Context, file string, opts *wfv1.SubmitOpts) error {
var body []byteView on GitHub (pinned to 35bff19146)
Solutions
- Change the stored template's artifact to a key-capable backend type, then re-submit.
- Remove the override for that artifact name and adjust the template source directly.
- Fix the URL in the template artifact so it parses.
Example fix
// before (in the WorkflowTemplate)
artifacts:
- name: code
git:
repo: https://github.com/x/y
// after
artifacts:
- name: code
oss:
key: builds/code.tgz Defensive patterns
Strategy: validation
Validate before calling
if wf.Status.StoredWorkflowSpec != nil {
for _, art := range wf.Status.StoredWorkflowSpec.Arguments.Artifacts {
if overrides[art.Name] != "" && (art.Git != nil || art.Raw != nil) {
return fmt.Errorf("stored-spec artifact %q cannot take a key override", art.Name)
}
}
} Type guard
func storedSpecSupportsOverrides(wf *wfv1.Workflow) bool {
if wf.Status.StoredWorkflowSpec == nil {
return true
}
for _, a := range wf.Status.StoredWorkflowSpec.Arguments.Artifacts {
if a.Git != nil || a.Raw != nil {
return false
}
}
return true
} Try / catch
err := util.ApplySubmitOpts(wf, opts)
if err != nil && strings.Contains(err.Error(), "in stored spec") {
// fix the WorkflowTemplate itself and resubmit
return err
} Prevention
- Keep WorkflowTemplate argument artifacts on key-capable storage types.
- Remember overrides must be valid in BOTH the local and stored specs.
- Version WorkflowTemplates and test overrides against each version.
When it happens
Trigger: Submitting with --artifact overrides against a workflow submitted via workflowTemplateRef, where the stored (template-derived) spec arguments contain a git/raw artifact or a malformed URL named in the overrides.
Common situations: Teams centralizing artifact definitions in WorkflowTemplates with git sources, then trying to re-point them with CLI key overrides — which is unsupported for git.
Related errors
- failed to set key for artifact %s: %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/b3b5b9a1f02dd7e9.
Report an issue: GitHub.