{"record":{"id":"29e976cc37ace2cb","repo":"kubernetes/kops","slug":"kubernetespath-createfile-not-supported","errorCode":null,"errorMessage":"KubernetesPath::CreateFile not supported","messagePattern":"KubernetesPath::CreateFile not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/k8sfs.go","lineNumber":98,"sourceCode":"}\n\nfunc (p *KubernetesPath) Join(relativePath ...string) Path {\n\targs := []string{p.key}\n\targs = append(args, relativePath...)\n\tjoined := path.Join(args...)\n\treturn &KubernetesPath{\n\t\tk8sContext: p.k8sContext,\n\t\thost:       p.host,\n\t\tkey:        joined,\n\t}\n}\n\nfunc (p *KubernetesPath) WriteFile(ctx context.Context, data io.ReadSeeker, acl ACL) error {\n\treturn fmt.Errorf(\"KubernetesPath::WriteFile not supported\")\n}\n\nfunc (p *KubernetesPath) CreateFile(ctx context.Context, data io.ReadSeeker, acl ACL) error {\n\treturn fmt.Errorf(\"KubernetesPath::CreateFile not supported\")\n}\n\n// ReadFile implements Path::ReadFile\nfunc (p *KubernetesPath) ReadFile(ctx context.Context) ([]byte, error) {\n\tvar b bytes.Buffer\n\t_, err := p.WriteTo(&b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b.Bytes(), nil\n}\n\n// WriteTo implements io.WriterTo\nfunc (p *KubernetesPath) WriteTo(out io.Writer) (int64, error) {\n\treturn 0, fmt.Errorf(\"KubernetesPath::WriteTo not supported\")\n}\n\nfunc (p *KubernetesPath) ReadDir() ([]Path, error) {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/k8sfs.go#L80-L116","documentation":"Hard guard: KubernetesPath.CreateFile always returns this error because k8s:// paths are read-only in the VFS abstraction. Unlike cloud-backends, there is no create-with-existence-check flow against the API server here, so any attempt to create a file object through a KubernetesPath fails immediately.","triggerScenarios":"Thrown at util/pkg/vfs/k8sfs.go:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the underlying ConfigMap/Secret via the Kubernetes API","Use a writable VFS backend (S3, GCS, memfs) for CreateFile semantics"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}