{"record":{"id":"b3b5b9a1f02dd7e9","repo":"argoproj/argo-workflows","slug":"failed-to-set-key-for-artifact-s-in-stored-spec","errorCode":null,"errorMessage":"failed to set key for artifact %s in stored spec: %w","messagePattern":"failed to set key for artifact (.+?) in stored spec: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/util/util.go","lineNumber":429,"sourceCode":"\t// Note: For workflowTemplateRef workflows, artifacts are handled in workflow_server.go\n\t// which has access to the WorkflowTemplate to copy the full artifact configuration\n\tconsumed := make(map[string]bool, len(overrides))\n\tfor i, artifact := range wf.Spec.Arguments.Artifacts {\n\t\tif newKey, ok := overrides[artifact.Name]; ok {\n\t\t\tconsumed[artifact.Name] = true\n\t\t\tif err := wf.Spec.Arguments.Artifacts[i].SetKey(newKey); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to set key for artifact %s: %w\", artifact.Name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Also update StoredWorkflowSpec if present\n\tif wf.Status.StoredWorkflowSpec != nil {\n\t\tfor i, artifact := range wf.Status.StoredWorkflowSpec.Arguments.Artifacts {\n\t\t\tif newKey, ok := overrides[artifact.Name]; ok {\n\t\t\t\tconsumed[artifact.Name] = true\n\t\t\t\tif err := wf.Status.StoredWorkflowSpec.Arguments.Artifacts[i].SetKey(newKey); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to set key for artifact %s in stored spec: %w\", artifact.Name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// For workflowTemplateRef workflows the artifacts live in the template, not here, so\n\t// unmatched overrides are expected and are validated on the templateRef path instead\n\t// (ApplyOverridesToTemplateArtifacts). Only flag unmatched overrides when this workflow\n\t// is the authority for its own artifacts.\n\tif wf.Spec.WorkflowTemplateRef == nil {\n\t\treturn unmatchedOverridesError(overrides, consumed)\n\t}\n\n\treturn nil\n}\n\nfunc ReadParametersFile(ctx context.Context, file string, opts *wfv1.SubmitOpts) error {\n\tvar body []byte","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/util/util.go#L411-L447","documentation":"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.","triggerScenarios":"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.","commonSituations":"Teams centralizing artifact definitions in WorkflowTemplates with git sources, then trying to re-point them with CLI key overrides — which is unsupported for git.","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."],"exampleFix":"// before (in the WorkflowTemplate)\nartifacts:\n  - name: code\n    git:\n      repo: https://github.com/x/y\n// after\nartifacts:\n  - name: code\n    oss:\n      key: builds/code.tgz","handlingStrategy":"validation","validationCode":"if wf.Status.StoredWorkflowSpec != nil {\n\tfor _, art := range wf.Status.StoredWorkflowSpec.Arguments.Artifacts {\n\t\tif overrides[art.Name] != \"\" && (art.Git != nil || art.Raw != nil) {\n\t\t\treturn fmt.Errorf(\"stored-spec artifact %q cannot take a key override\", art.Name)\n\t\t}\n\t}\n}","typeGuard":"func storedSpecSupportsOverrides(wf *wfv1.Workflow) bool {\n\tif wf.Status.StoredWorkflowSpec == nil {\n\t\treturn true\n\t}\n\tfor _, a := range wf.Status.StoredWorkflowSpec.Arguments.Artifacts {\n\t\tif a.Git != nil || a.Raw != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}","tryCatchPattern":"err := util.ApplySubmitOpts(wf, opts)\nif err != nil && strings.Contains(err.Error(), \"in stored spec\") {\n\t// fix the WorkflowTemplate itself and resubmit\n\treturn err\n}","preventionTips":["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."],"tags":["artifacts","workflowtemplate","override","unsupported-type"],"backgroundTag":"artifact-key-unsupported","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"}