{"record":{"id":"e90e2bf14b87ac2a","repo":"kubernetes/kops","slug":"building-vfs-path-w","errorCode":null,"errorMessage":"building vfs path: %w","messagePattern":"building vfs path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/toolbox_enroll.go","lineNumber":877,"sourceCode":"\n\t// If this is the control plane, we want to copy the config from s3/gcs to the local file system on the target node,\n\t// so that we don't need credentials to the state store.\n\tif bootConfig.InstanceGroupRole.HasControlPlane() {\n\t\tremapPrefix := \"s3://\" // TODO: Support GCS?\n\n\t\t// targetDir is the location of the config on the target node.\n\t\ttargetDir := \"/etc/kubernetes/kops/config\"\n\n\t\t// remapFile remaps a file from s3/gcs etc to the local file system on the target node.\n\t\tremapFile := func(pSrc *string, destDir string) error {\n\t\t\tsrc := *pSrc\n\t\t\tif !strings.HasPrefix(src, remapPrefix) {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tsrcPath, err := vfsContext.BuildVfsPath(src)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"building vfs path: %w\", err)\n\t\t\t}\n\t\t\tb, err := srcPath.ReadFile(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"reading file: %w\", err)\n\t\t\t}\n\n\t\t\tdest := strings.TrimPrefix(src, remapPrefix)\n\t\t\tdest = path.Join(destDir, dest)\n\t\t\tbootstrapData.NodeupScriptAdditionalFiles[dest] = b\n\n\t\t\t*pSrc = dest\n\t\t\treturn nil\n\t\t}\n\n\t\t// remapTree remaps a file tree from s3/gcs etc to the local file system on the target node.\n\t\tremapTree := func(pSrc *string, dest string) error {\n\t\t\tsrc := *pSrc\n\t\t\tif !strings.HasPrefix(src, remapPrefix) {","sourceCodeStart":859,"sourceCodeEnd":895,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/commands/toolbox_enroll.go#L859-L895","documentation":"When remapping nodeup script additional files, each source URI under remapPrefix is resolved via vfsContext.BuildVfsPath. If the URI is not a valid/parseable VFS path (bad scheme, malformed path), BuildVfsPath errors and it is wrapped as 'building vfs path: %w'. The file is never read.","triggerScenarios":"A nodeup script additional-file source string with an unsupported VFS scheme or malformed URI (e.g. typo'd s3:// path, missing bucket, unsupported file:// form) is processed by the remap closure in GetBootstrapData/RunToolboxEnroll.","commonSituations":"Hand-written kopsBootScript nodeup script additional files with wrong paths; state store scheme mismatch (memfs vs s3) in tests or dry-runs; URL containing characters VFS cannot parse.","solutions":["Read the wrapped cause — it names the invalid path/scheme.","Correct the source URI scheme and path (must match a supported VFS backend: s3://, gs://, file://, etc.).","Verify the path exists and is spelled exactly (bucket, prefix).","Test with `kops toolbox template`/dry-run to confirm the path resolves before running enroll."],"exampleFix":"// before\nnodeup script additional file: src=\"s3:/bucket/files/conf.yaml\"   // malformed scheme\n// after\nsrc=\"s3://bucket/files/conf.yaml\"","handlingStrategy":"validation","validationCode":"// Validate the additional-file source URI scheme/path before use\nu, err := url.Parse(src)\nif err != nil || (u.Scheme != \"s3\" && u.Scheme != \"gs\" && u.Scheme != \"file\" && u.Scheme != \"memfs\") {\n\treturn fmt.Errorf(\"unsupported additional-file source %q\", src)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n\tif strings.Contains(err.Error(), \"building vfs path\") {\n\t\treturn fmt.Errorf(\"check additional-file URI scheme/path: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Use canonical VFS URIs (s3://bucket/key) — never single-slash forms","Lint nodeup script additionalFiles entries before applying","Match the VFS scheme to a backend compiled into your kops binary"],"tags":["kops","vfs","path","nodeup"],"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"}