{"record":{"id":"17e59fcf9a04e38a","repo":"kubernetes/kops","slug":"error-reading-from-s","errorCode":null,"errorMessage":"error reading from %s","messagePattern":"error reading from (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/templates/templates.go","lineNumber":59,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn t, nil\n}\n\nfunc (t *Templates) Find(key string) fi.Resource {\n\treturn t.resources[key]\n}\n\n// IsTemplate reports whether key was loaded from a file ending in .template.\nfunc (t *Templates) IsTemplate(key string) bool {\n\treturn t.isTemplate[key]\n}\n\nfunc (t *Templates) loadFrom(ctx context.Context, base vfs.Path) error {\n\tfiles, err := base.ReadTree(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading from %s\", base)\n\t}\n\n\tfor _, f := range files {\n\t\tcontents, err := f.ReadFile(ctx)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\t// This is just an annoyance of gobindata - we can't tell the difference between files & directories.  Ignore.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"error reading %s: %v\", f, err)\n\t\t}\n\n\t\tkey, err := vfs.RelativePath(base, f)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting relative path for %s\", f)\n\t\t}\n\n\t\tisTemplate := strings.HasSuffix(key, \".template\")","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/templates/templates.go#L41-L77","documentation":"Templates.loadFrom walks a vfs tree (base path, e.g. a model directory or S3/GCS location) to discover template resources. If ReadTree on the base path fails, the walk cannot proceed and the whole load fails with this error naming the base path. It deliberately discards the underlying error, so the cause must be inferred from the path.","triggerScenarios":"Calling LoadTemplates with a base vfs.Path whose backing store is unreachable: the directory does not exist, cloud credentials are missing/invalid, a network error occurs, or the VFS location is wrong.","commonSituations":"Typo in the models directory or --model path, S3/GCS bucket deleted or inaccessible (expired credentials, wrong region), or running kops against a state store that was moved.","solutions":["Verify the base path exists and is spelled correctly (check the path printed in the error)","Check cloud/storage credentials: run with -v=10 or test access to the VFS location (e.g. aws s3 ls s3://your-bucket)","Check network connectivity / proxy settings to the storage backend","If the directory is genuinely absent, recreate it or point LoadTemplates at the correct location"],"exampleFix":"// before\ntemplates, err := templates.LoadTemplates(ctx, vfs.NewFSOrDie().BuildWritablePath(\"assetfs/model/wrongmodel\"))\n// after\ntemplates, err := templates.LoadTemplates(ctx, vfs.NewFSOrDie().BuildWritablePath(\"assetfs/model/awsmodel\"))","handlingStrategy":"validation","validationCode":"// Ensure the base path exists before LoadTemplates\nif _, err := base.Exists(ctx); err != nil {\n\treturn fmt.Errorf(\"template base %s unreachable: %w\", base, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the --model / template directory path spelling before running","Check VFS/cloud credentials (S3/GCS) are valid for the state store","Test raw access to the path first (aws s3 ls / ls <dir>)","Run with -v=10 to see which VFS location failed"],"tags":["vfs","templates","io"],"backgroundTag":"vfs-path-not-found","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"}