argoproj/argo-workflows · error

set type not supported for type: %v

Error message

set type not supported for type: %v

What it means

ArtifactLocation.SetType clears the location and allocates an empty value of the given artifact backend type. If the passed ArtifactLocationType is a concrete type SetType does not know about (not in its type switch), it returns this error including the Go reflect type name.

Source

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

		a.Artifactory = &ArtifactoryArtifact{}
	case *AzureArtifact:
		a.Azure = &AzureArtifact{}
	case *GCSArtifact:
		a.GCS = &GCSArtifact{}
	case *HDFSArtifact:
		a.HDFS = &HDFSArtifact{}
	case *HTTPArtifact:
		a.HTTP = &HTTPArtifact{}
	case *OSSArtifact:
		a.OSS = &OSSArtifact{}
	case *RawArtifact:
		a.Raw = &RawArtifact{}
	case *S3Artifact:
		a.S3 = &S3Artifact{}
	case *PluginArtifact:
		a.Plugin = &PluginArtifact{}
	default:
		return fmt.Errorf("set type not supported for type: %v", reflect.TypeOf(v))
	}
	return nil
}

func (a *ArtifactLocation) HasLocationOrKey() bool {
	return a.HasLocation() || a.HasKey()
}

// HasKey returns whether or not an artifact has a key. They may or may not also HasLocation.
func (a *ArtifactLocation) HasKey() bool {
	key, _ := a.GetKey()
	return key != ""
}

// SetKey sets the key to a new value; use path.Join to combine items.
func (a *ArtifactLocation) SetKey(key string) error {
	v, err := a.Get()
	if err != nil {

View on GitHub (pinned to 35bff19146)

Solutions

  1. Upgrade the argo-workflows library to a version whose SetType supports the backend type you pass
  2. Only pass supported types: ArtifactoryArtifact, AzureArtifact, GCSArtifact, GitArtifact, HTTPArtifact, HDFSArtifact, OSSArtifact, RawArtifact, S3Artifact, PluginArtifact
  3. Set the artifact field directly on ArtifactLocation instead of using SetType for unsupported types

Example fix

// before
type myLoc struct{}
err := loc.SetType((*myLoc)(nil)) // set type not supported
// after
err := loc.SetType((*S3Artifact)(nil))
Defensive patterns

Strategy: type-guard

Validate before calling

switch v.(type) {
case *S3Artifact, *GCSArtifact, *GitArtifact, *HTTPArtifact, *RawArtifact, *AzureArtifact, *ArtifactoryArtifact, *OSSArtifact, *HDFSArtifact, *PluginArtifact:
    // supported
default:
    return errors.New("unsupported artifact type for SetType")
}

Type guard

func isSettableArtifactType(v ArtifactLocationType) bool {
    switch v.(type) {
    case *S3Artifact, *GCSArtifact, *GitArtifact, *HTTPArtifact, *RawArtifact, *AzureArtifact, *ArtifactoryArtifact, *OSSArtifact, *HDFSArtifact, *PluginArtifact:
        return true
    }
    return false
}

Try / catch

if err := loc.SetType(v); err != nil {
    return fmt.Errorf("cannot initialize artifact location for %T: %w", v, err)
}

Prevention

When it happens

Trigger: Calling SetType with a custom or newly added ArtifactLocationType implementation that is not handled in the switch (e.g. a PluginArtifact in an older version, or a user-defined ArtifactLocationType in tests).

Common situations: Code written against a newer argo version calling SetType with a backend added after the running library version; tests passing mock artifact types.

Related errors


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