{"record":{"id":"584ac0129fc8d7a2","repo":"argoproj/argo-workflows","slug":"key-unsupported-cannot-get-key-for-artifact-locat","errorCode":null,"errorMessage":"key unsupported: cannot get key for artifact location, because it is invalid","messagePattern":"key unsupported: cannot get key for artifact location, because it is invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/workflow_types.go","lineNumber":1423,"sourceCode":"\tRaw *RawArtifact `json:\"raw,omitempty\" protobuf:\"bytes,7,opt,name=raw\"`\n\n\t// OSS contains OSS artifact location details\n\tOSS *OSSArtifact `json:\"oss,omitempty\" protobuf:\"bytes,8,opt,name=oss\"`\n\n\t// GCS contains GCS artifact location details\n\tGCS *GCSArtifact `json:\"gcs,omitempty\" protobuf:\"bytes,9,opt,name=gcs\"`\n\n\t// Azure contains Azure Storage artifact location details\n\tAzure *AzureArtifact `json:\"azure,omitempty\" protobuf:\"bytes,10,opt,name=azure\"`\n\n\t// Plugin contains plugin artifact location details\n\tPlugin *PluginArtifact `json:\"plugin,omitempty\" protobuf:\"bytes,11,opt,name=plugin\"`\n}\n\nfunc (a *ArtifactLocation) Get() (ArtifactLocationType, error) {\n\tswitch {\n\tcase a == nil:\n\t\treturn nil, fmt.Errorf(\"key unsupported: cannot get key for artifact location, because it is invalid\")\n\tcase a.Artifactory != nil:\n\t\treturn a.Artifactory, nil\n\tcase a.Azure != nil:\n\t\treturn a.Azure, nil\n\tcase a.Git != nil:\n\t\treturn a.Git, nil\n\tcase a.GCS != nil:\n\t\treturn a.GCS, nil\n\tcase a.HDFS != nil:\n\t\treturn a.HDFS, nil\n\tcase a.HTTP != nil:\n\t\treturn a.HTTP, nil\n\tcase a.OSS != nil:\n\t\treturn a.OSS, nil\n\tcase a.Raw != nil:\n\t\treturn a.Raw, nil\n\tcase a.S3 != nil:\n\t\treturn a.S3, nil","sourceCodeStart":1405,"sourceCodeEnd":1441,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/workflow_types.go#L1405-L1441","documentation":"ArtifactLocation.Get resolves which artifact storage backend (S3, Git, HTTP, Raw, etc.) is populated on an ArtifactLocation and returns it as an ArtifactLocationType. If the ArtifactLocation pointer is nil, there is no backend selected, so no key/location can be derived and this error is returned.","triggerScenarios":"Calling Get() on a nil *ArtifactLocation, or via GetKey()/HasLocation on an artifact whose location union field is entirely unset (no s3, git, http, raw, artifactory, azure, gcs, oss, hdfs, or plugin member set).","commonSituations":"A template references an artifact in outputs/inputs without configuring any artifact repository backend; programmatically constructing an Artifact without setting any location field; controller code dereferencing an unset artifact location.","solutions":["Configure the artifact repository in the workflow-controller configmap (e.g. set the s3 or gcs block)","Set a concrete location field on the artifact (e.g. s3: {bucket, key})","Guard callers with a nil/HasLocation check before calling Get()/GetKey()"],"exampleFix":"// before\nvar a *ArtifactLocation\nloc, err := a.Get() // error\n// after\na := &ArtifactLocation{S3: &S3Artifact{...}}\nloc, err := a.Get()","handlingStrategy":"type-guard","validationCode":"if loc == nil || (!loc.HasLocation() && !loc.HasKey()) {\n    return errors.New(\"artifact has no configured location\")\n}","typeGuard":"func hasArtifactLocation(a *ArtifactLocation) bool {\n    return a != nil && a.HasLocation()\n}","tryCatchPattern":"key, err := artifactLocation.GetKey()\nif err != nil {\n    return fmt.Errorf(\"artifact location unresolvable (is artifact storage configured?): %w\", err)\n}","preventionTips":["Always configure artifactRepository in the controller configmap","Check HasLocation()/HasKey() before Get/GetKey","Set explicit artifact locations in templates when unsure of cluster config"],"tags":["artifacts","artifact-location","validation"],"backgroundTag":"artifact-storage-not-configured","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"}