{"record":{"id":"38c0640c706db5c3","repo":"kubernetes/kops","slug":"error-parsing-locationstore-q-w","errorCode":null,"errorMessage":"error parsing locationStore=%q: %w","messagePattern":"error parsing locationStore=%q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/discovery.go","lineNumber":56,"sourceCode":"\n\tif clusterSpec.KubeAPIServer == nil {\n\t\tclusterSpec.KubeAPIServer = &kops.KubeAPIServerConfig{}\n\t}\n\n\tkubeAPIServer := clusterSpec.KubeAPIServer\n\n\tif len(kubeAPIServer.APIAudiences) == 0 {\n\t\tkubeAPIServer.APIAudiences = []string{\"kubernetes.svc.default\"}\n\t}\n\n\tif kubeAPIServer.ServiceAccountIssuer == nil {\n\t\tsaid := clusterSpec.ServiceAccountIssuerDiscovery\n\t\tvar serviceAccountIssuer string\n\t\tif said != nil && said.DiscoveryStore != \"\" {\n\t\t\tstore := said.DiscoveryStore\n\t\t\tbase, err := vfs.Context.BuildVfsPath(store)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing locationStore=%q: %w\", store, err)\n\t\t\t}\n\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)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/discovery.go#L38-L74","documentation":"BuildOptions resolves ServiceAccountIssuerDiscovery.DiscoveryStore into a VFS path to derive the service account issuer URL. If vfs.Context.BuildVfsPath cannot parse the store location string, the error is wrapped as 'error parsing locationStore=...'.","triggerScenarios":"Setting cluster.spec.serviceAccountIssuerDiscovery.discoveryStore to a malformed or unsupported location (bad scheme, invalid S3 URL) before/while running kops build options (e.g. during cluster update).","commonSituations":"Typo in the store URI scheme; using a scheme not compiled into VFS; hand-edited cluster spec with invalid URL; region/bucket characters that fail URL parsing.","solutions":["Correct the discoveryStore value in the cluster spec to a valid vfs path (e.g. s3://bucket/path)","Check the wrapped inner error (%w) for the exact parse failure and fix that part of the URL","Use kops toolbox to validate the cluster spec before applying"],"exampleFix":"// before\nserviceAccountIssuerDiscovery:\n  discoveryStore: \"s3:/bad bucket/path\"\n// after\nserviceAccountIssuerDiscovery:\n  discoveryStore: \"s3://my-bucket/sa-discovery\"","handlingStrategy":"validation","validationCode":"u, err := url.Parse(discoveryStore)\nif err != nil || u.Scheme == \"\" {\n    return fmt.Errorf(\"discoveryStore must be a valid vfs path, got %q\", discoveryStore)\n}","typeGuard":"null","tryCatchPattern":"if err := b.BuildOptions(...); err != nil {\n    var parseErr error\n    if strings.Contains(err.Error(), \"error parsing locationStore=\") {\n        // fix discoveryStore in cluster spec and retry\n    }\n    return err\n}","preventionTips":["Validate the cluster spec (kops replace/validate) before applying","Keep discoveryStore values as plain s3:// URLs without typos","Lint cluster YAML for scheme typos"],"tags":["config","vfs","url-parsing","service-account"],"backgroundTag":"invalid-url-syntax","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}