argoproj/argo-workflows · error

key unsupported: cannot get key for artifact location, becau

Error message

key unsupported: cannot get key for artifact location, because it is invalid

What it means

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.

Source

Thrown at pkg/apis/workflow/v1alpha1/workflow_types.go:1423

	Raw *RawArtifact `json:"raw,omitempty" protobuf:"bytes,7,opt,name=raw"`

	// OSS contains OSS artifact location details
	OSS *OSSArtifact `json:"oss,omitempty" protobuf:"bytes,8,opt,name=oss"`

	// GCS contains GCS artifact location details
	GCS *GCSArtifact `json:"gcs,omitempty" protobuf:"bytes,9,opt,name=gcs"`

	// Azure contains Azure Storage artifact location details
	Azure *AzureArtifact `json:"azure,omitempty" protobuf:"bytes,10,opt,name=azure"`

	// Plugin contains plugin artifact location details
	Plugin *PluginArtifact `json:"plugin,omitempty" protobuf:"bytes,11,opt,name=plugin"`
}

func (a *ArtifactLocation) Get() (ArtifactLocationType, error) {
	switch {
	case a == nil:
		return nil, fmt.Errorf("key unsupported: cannot get key for artifact location, because it is invalid")
	case a.Artifactory != nil:
		return a.Artifactory, nil
	case a.Azure != nil:
		return a.Azure, nil
	case a.Git != nil:
		return a.Git, nil
	case a.GCS != nil:
		return a.GCS, nil
	case a.HDFS != nil:
		return a.HDFS, nil
	case a.HTTP != nil:
		return a.HTTP, nil
	case a.OSS != nil:
		return a.OSS, nil
	case a.Raw != nil:
		return a.Raw, nil
	case a.S3 != nil:
		return a.S3, nil

View on GitHub (pinned to 35bff19146)

Solutions

  1. Configure the artifact repository in the workflow-controller configmap (e.g. set the s3 or gcs block)
  2. Set a concrete location field on the artifact (e.g. s3: {bucket, key})
  3. Guard callers with a nil/HasLocation check before calling Get()/GetKey()

Example fix

// before
var a *ArtifactLocation
loc, err := a.Get() // error
// after
a := &ArtifactLocation{S3: &S3Artifact{...}}
loc, err := a.Get()
Defensive patterns

Strategy: type-guard

Validate before calling

if loc == nil || (!loc.HasLocation() && !loc.HasKey()) {
    return errors.New("artifact has no configured location")
}

Type guard

func hasArtifactLocation(a *ArtifactLocation) bool {
    return a != nil && a.HasLocation()
}

Try / catch

key, err := artifactLocation.GetKey()
if err != nil {
    return fmt.Errorf("artifact location unresolvable (is artifact storage configured?): %w", err)
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/584ac0129fc8d7a2. Report an issue: GitHub.