{"record":{"id":"53c3e589e5a5bcf4","repo":"kubernetes/kops","slug":"locationstore-q-is-of-unexpected-type-t","errorCode":null,"errorMessage":"locationStore=%q is of unexpected type %T","messagePattern":"locationStore=%q is of unexpected type %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/discovery.go","lineNumber":76,"sourceCode":"\t\t\tswitch base := base.(type) {\n\t\t\tcase *vfs.S3Path:\n\t\t\t\tserviceAccountIssuer, err = base.GetHTTPsUrl(clusterSpec.IsIPv6Only())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tcase *vfs.GSPath:\n\t\t\t\tserviceAccountIssuer, err = base.GetHTTPsUrl()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tcase *vfs.MemFSPath:\n\t\t\t\tif !base.IsClusterReadable() {\n\t\t\t\t\t// If this _is_ a test, we should call MarkClusterReadable\n\t\t\t\t\treturn fmt.Errorf(\"locationStore=%q is only supported in tests\", store)\n\t\t\t\t}\n\t\t\t\tserviceAccountIssuer = strings.Replace(base.Path(), \"memfs://\", \"https://\", 1)\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"locationStore=%q is of unexpected type %T\", store, base)\n\t\t\t}\n\t\t} else if said != nil && said.DiscoveryService != nil {\n\t\t\tdiscoveryService := said.DiscoveryService\n\n\t\t\tserviceAccountIssuer = discoveryService.URL\n\t\t\tif serviceAccountIssuer == \"\" {\n\t\t\t\treturn fmt.Errorf(\"discoveryService URL must be specified\")\n\t\t\t}\n\t\t} else {\n\t\t\tif supportsPublicJWKS(clusterSpec) && clusterSpec.API.PublicName != \"\" {\n\t\t\t\tserviceAccountIssuer = \"https://\" + clusterSpec.API.PublicName\n\t\t\t} else {\n\t\t\t\tserviceAccountIssuer = \"https://api.internal.\" + b.ClusterName\n\t\t\t}\n\t\t}\n\t\tkubeAPIServer.ServiceAccountIssuer = &serviceAccountIssuer\n\t}\n\tkubeAPIServer.ServiceAccountJWKSURI = new(*kubeAPIServer.ServiceAccountIssuer + \"/openid/v1/jwks\")","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/discovery.go#L58-L94","documentation":"After parsing discoveryStore, kOps switches on the concrete VFS path type and only supports S3 and MemFS paths. Any other store type (file://, gs://, azblob://, etc.) hits the default branch and returns this 'unexpected type' error with the Go type in the message.","triggerScenarios":"Setting discoveryStore to a supported-by-VFS-but-unsupported-for-discovery path type such as file:// or gs:// while BuildOptions runs.","commonSituations":"Assuming any object store works for issuer discovery when only S3 is implemented; porting configs between clouds.","solutions":["Use an S3 path (s3://...) for discoveryStore","Or omit discoveryStore and rely on the default issuer (https://api.<clustername> / API public name)","Add support for the desired VFS type in pkg/model/components/discovery.go if you control the fork"],"exampleFix":"// before\nserviceAccountIssuerDiscovery:\n  discoveryStore: \"gs://my-bucket/discovery\"\n// after\nserviceAccountIssuerDiscovery:\n  discoveryStore: \"s3://my-bucket/discovery\"","handlingStrategy":"type-guard","validationCode":"base, err := vfs.Context.BuildVfsPath(store)\nif err == nil {\n    switch base.(type) {\n    case *vfs.S3Path, *vfs.MemFSPath:\n    default:\n        return fmt.Errorf(\"discoveryStore %s must be an S3 path\", store)\n    }\n}","typeGuard":"func isSupportedDiscoveryPath(base vfs.VFSPath) bool {\n    switch base.(type) {\n    case *vfs.S3Path, *vfs.MemFSPath:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := buildOptions(); err != nil {\n    if strings.Contains(err.Error(), \"unexpected type\") {\n        // switch discoveryStore to s3:// in the spec\n    }\n    return err\n}","preventionTips":["Only use s3:// for discoveryStore today","Consult the discovery.go switch for supported types before choosing a store","Document supported backends in cluster templates"],"tags":["config","vfs","unsupported-type","service-account"],"backgroundTag":"unsupported-storage-backend","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}