{"record":{"id":"6f6ec32233b82f7c","repo":"kubernetes/kops","slug":"invalid-kubernetes-vfs-path-q","errorCode":null,"errorMessage":"invalid kubernetes vfs path: %q","messagePattern":"invalid kubernetes vfs path: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/context.go","lineNumber":459,"sourceCode":"\t}\n\n\tbucket := strings.TrimSuffix(u.Host, \"/\")\n\tif bucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"invalid Hetzner object storage path: %q\", p)\n\t}\n\n\ts3path := newS3Path(c.s3Context, u.Scheme, bucket, u.Path, false, func(o *s3.Options) {\n\t\to.BaseEndpoint = aws.String(endpoint)\n\t\to.UsePathStyle = true\n\t\to.DisableLogOutputChecksumValidationSkipped = true\n\t})\n\treturn s3path, nil\n}\n\nfunc (c *VFSContext) buildKubernetesPath(p string) (*KubernetesPath, error) {\n\tu, err := url.Parse(p)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid kubernetes vfs path: %q\", p)\n\t}\n\tif u.Scheme != \"k8s\" {\n\t\treturn nil, fmt.Errorf(\"invalid kubernetes vfs path: %q\", p)\n\t}\n\n\tbucket := strings.TrimSuffix(u.Host, \"/\")\n\tif bucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"invalid kubernetes vfs path: %q\", p)\n\t}\n\n\tk8sPath := newKubernetesPath(c.k8sContext, bucket, u.Path)\n\treturn k8sPath, nil\n}\n\nfunc (c *VFSContext) buildMemFSPath(p string) (*MemFSPath, error) {\n\tif !strings.HasPrefix(p, \"memfs://\") {\n\t\treturn nil, fmt.Errorf(\"memfs path not recognized: %q\", p)\n\t}","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/context.go#L441-L477","documentation":"buildKubernetesPath converts 'k8s://' VFS paths into a KubernetesPath served through the in-cluster k8s context. If the raw string cannot be parsed by url.Parse, kOps cannot construct the path and throws this error before checking the scheme or bucket.","triggerScenarios":"BuildVfsPath dispatches to buildKubernetesPath and url.Parse(p) returns an error for the given path string (e.g. malformed percent-escapes like k8s://bucket/%zz or control characters in the path).","commonSituations":"A k8s:// state store value assembled by a script with unescaped special characters; an invalid percent-encoding sequence pasted into the path; a corrupted config value in KOPS_STATE_STORE.","solutions":["Rewrite the path in canonical form k8s://<bucket-or-context>/<key> with valid percent-encoding","Check KOPS_STATE_STORE / the --state-store flag for stray characters or truncated values","URL-encode any special characters in keys (%20 for spaces, etc.)"],"exampleFix":"// before (invalid escape)\nk8s://bucket/%zz/key\n// after\nk8s://bucket/key","handlingStrategy":"validation","validationCode":"if _, err := url.Parse(stateStore); err != nil {\n\treturn fmt.Errorf(\"kubernetes vfs path %q is not a valid URL: %w\", stateStore, err)\n}","typeGuard":null,"tryCatchPattern":"p, err := vfs.Context.BuildVfsPath(stateStore)\nif err != nil {\n\tif strings.Contains(err.Error(), \"invalid kubernetes vfs path\") {\n\t\treturn fmt.Errorf(\"state store %q failed URL parsing; use k8s://<bucket>/<key>\", stateStore)\n\t}\n\treturn err\n}","preventionTips":["Use canonical form k8s://<bucket>/<key>","Percent-encode special characters in keys","Check KOPS_STATE_STORE for corruption from scripts or shell expansion"],"tags":["vfs","kubernetes","url-parsing"],"backgroundTag":"invalid-vfs-path","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"}