{"record":{"id":"67a89c6bf9585603","repo":"argoproj/argo-workflows","slug":"failed-to-set-key-for-artifact-s-w","errorCode":null,"errorMessage":"failed to set key for artifact %s: %w","messagePattern":"failed to set key for artifact (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/util/util.go","lineNumber":373,"sourceCode":"// ApplyOverridesToTemplateArtifacts returns a deep copy of each artifact in templateArtifacts\n// whose name has an entry in overrides, with its key set to the override value. Artifacts\n// without a matching override are omitted from the result. Every override must match a\n// template artifact; an override naming an unknown artifact is an error rather than a silent\n// no-op, so a typo'd or stale override does not run the workflow with default settings after\n// the caller was told the upload succeeded. This is a pure function: it does not resolve\n// artifact repositories or mutate its inputs.\nfunc ApplyOverridesToTemplateArtifacts(templateArtifacts []wfv1.Artifact, overrides map[string]string) ([]wfv1.Artifact, error) {\n\tapplied := make([]wfv1.Artifact, 0, len(overrides))\n\tconsumed := make(map[string]bool, len(overrides))\n\tfor _, tmplArt := range templateArtifacts {\n\t\tnewKey, ok := overrides[tmplArt.Name]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tconsumed[tmplArt.Name] = true\n\t\tartCopy := tmplArt.DeepCopy()\n\t\tif err := artCopy.SetKey(newKey); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to set key for artifact %s: %w\", tmplArt.Name, err)\n\t\t}\n\t\tapplied = append(applied, *artCopy)\n\t}\n\tif err := unmatchedOverridesError(overrides, consumed); err != nil {\n\t\treturn nil, err\n\t}\n\treturn applied, nil\n}\n\n// unmatchedOverridesError names any override whose artifact name matched no artifact, so a\n// typo'd or stale override surfaces as an error instead of being silently dropped. Returns\n// nil when every override was consumed.\nfunc unmatchedOverridesError(overrides map[string]string, consumed map[string]bool) error {\n\tunmatched := make([]string, 0)\n\tfor name := range overrides {\n\t\tif !consumed[name] {\n\t\t\tunmatched = append(unmatched, name)\n\t\t}","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/util/util.go#L355-L391","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nartifacts:\n  - name: src\n    git:\n      repo: https://github.com/x/y\n// after (key-addressed backend that supports SetKey)\nartifacts:\n  - name: src\n    s3:\n      key: path/in/bucket","handlingStrategy":"validation","validationCode":"for _, art := range templateArtifacts {\n\tif overrides[art.Name] == \"\" {\n\t\tcontinue\n\t}\n\tif art.HasLocation() && (art.Git != nil || art.Raw != nil) {\n\t\treturn fmt.Errorf(\"artifact %q (%s) does not support key overrides\", art.Name, art.ArtifactLocation.GetType())\n\t}\n}","typeGuard":"func supportsSetKey(a wfv1.Artifact) bool {\n\treturn a.S3 != nil || a.GCS != nil || a.OSS != nil || a.Azure != nil ||\n\t\ta.HDFS != nil || a.HTTP != nil || a.Artifactory != nil || a.Plugin != nil\n}","tryCatchPattern":"applied, err := util.ApplyOverridesToTemplateArtifacts(tmplArts, overrides)\nif err != nil {\n\tvar keyErr *fmt.Errorf // inspect wrapped 'key unsupported' error\n\treturn fmt.Errorf(\"artifact override rejected: %w\", err)\n}","preventionTips":["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."],"tags":["artifacts","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"}