{"record":{"id":"8ec103878ae32282","repo":"argoproj/argo-workflows","slug":"set-type-not-supported-for-type-v","errorCode":null,"errorMessage":"set type not supported for type: %v","messagePattern":"set type not supported for type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/workflow_types.go","lineNumber":1472,"sourceCode":"\t\ta.Artifactory = &ArtifactoryArtifact{}\n\tcase *AzureArtifact:\n\t\ta.Azure = &AzureArtifact{}\n\tcase *GCSArtifact:\n\t\ta.GCS = &GCSArtifact{}\n\tcase *HDFSArtifact:\n\t\ta.HDFS = &HDFSArtifact{}\n\tcase *HTTPArtifact:\n\t\ta.HTTP = &HTTPArtifact{}\n\tcase *OSSArtifact:\n\t\ta.OSS = &OSSArtifact{}\n\tcase *RawArtifact:\n\t\ta.Raw = &RawArtifact{}\n\tcase *S3Artifact:\n\t\ta.S3 = &S3Artifact{}\n\tcase *PluginArtifact:\n\t\ta.Plugin = &PluginArtifact{}\n\tdefault:\n\t\treturn fmt.Errorf(\"set type not supported for type: %v\", reflect.TypeOf(v))\n\t}\n\treturn nil\n}\n\nfunc (a *ArtifactLocation) HasLocationOrKey() bool {\n\treturn a.HasLocation() || a.HasKey()\n}\n\n// HasKey returns whether or not an artifact has a key. They may or may not also HasLocation.\nfunc (a *ArtifactLocation) HasKey() bool {\n\tkey, _ := a.GetKey()\n\treturn key != \"\"\n}\n\n// SetKey sets the key to a new value; use path.Join to combine items.\nfunc (a *ArtifactLocation) SetKey(key string) error {\n\tv, err := a.Get()\n\tif err != nil {","sourceCodeStart":1454,"sourceCodeEnd":1490,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/workflow_types.go#L1454-L1490","documentation":"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.","triggerScenarios":"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).","commonSituations":"Code written against a newer argo version calling SetType with a backend added after the running library version; tests passing mock artifact types.","solutions":["Upgrade the argo-workflows library to a version whose SetType supports the backend type you pass","Only pass supported types: ArtifactoryArtifact, AzureArtifact, GCSArtifact, GitArtifact, HTTPArtifact, HDFSArtifact, OSSArtifact, RawArtifact, S3Artifact, PluginArtifact","Set the artifact field directly on ArtifactLocation instead of using SetType for unsupported types"],"exampleFix":"// before\ntype myLoc struct{}\nerr := loc.SetType((*myLoc)(nil)) // set type not supported\n// after\nerr := loc.SetType((*S3Artifact)(nil))","handlingStrategy":"type-guard","validationCode":"switch v.(type) {\ncase *S3Artifact, *GCSArtifact, *GitArtifact, *HTTPArtifact, *RawArtifact, *AzureArtifact, *ArtifactoryArtifact, *OSSArtifact, *HDFSArtifact, *PluginArtifact:\n    // supported\ndefault:\n    return errors.New(\"unsupported artifact type for SetType\")\n}","typeGuard":"func isSettableArtifactType(v ArtifactLocationType) bool {\n    switch v.(type) {\n    case *S3Artifact, *GCSArtifact, *GitArtifact, *HTTPArtifact, *RawArtifact, *AzureArtifact, *ArtifactoryArtifact, *OSSArtifact, *HDFSArtifact, *PluginArtifact:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := loc.SetType(v); err != nil {\n    return fmt.Errorf(\"cannot initialize artifact location for %T: %w\", v, err)\n}","preventionTips":["Only pass built-in artifact types to SetType","Assign the ArtifactLocation field directly for custom types","Keep the argo library version in sync with code using new artifact backends"],"tags":["artifacts","type-switch","unsupported-type"],"backgroundTag":"unsupported-artifact-type","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"}