{"record":{"id":"c38d364f393d61b4","repo":"kubernetes/kops","slug":"error-reading-s-v-c38d36","errorCode":null,"errorMessage":"error reading %s: %v","messagePattern":"error reading (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/templates/templates.go","lineNumber":69,"sourceCode":"// 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\")\n\t\tkey = strings.TrimSuffix(key, \".template\")\n\t\tklog.V(6).Infof(\"loading resource %q\", key)\n\t\tt.resources[key] = fi.NewBytesResource(contents)\n\t\tt.isTemplate[key] = isTemplate\n\t}\n\treturn nil\n}\n","sourceCodeStart":51,"sourceCodeEnd":85,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/templates/templates.go#L51-L85","documentation":"After listing the tree, loadFrom reads each file's contents. A read failure that is NOT os.IsNotExist is fatal: the file exists in the listing but its contents could not be fetched, so the template set is incomplete and the error reports which file failed.","triggerScenarios":"f.ReadFile(ctx) on an entry from base.ReadTree fails with a permission, network, checksum, or partial-read error (anything other than IsNotExist).","commonSituations":"S3 object deleted between listing and read, IAM policy lacking GetObject on some objects, corrupted gobindata asset, or an intermittent storage/network failure during cluster spec rendering.","solutions":["Re-run the command; intermittent storage/network failures often resolve","Check read permissions on the named file in the VFS backend (IAM/ACLs)","Re-sync or restore the missing/corrupt file in the template directory","If from embedded assets, rebuild kops (make kops) to regenerate gobindata"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// Pre-check readability of the tree entry\nif _, err := f.ReadFile(ctx); err != nil && !os.IsNotExist(err) {\n\tklog.Warningf(\"file %s may be unreadable: %v\", f, err)\n}","typeGuard":null,"tryCatchPattern":"contents, err := f.ReadFile(ctx)\nif err != nil && !os.IsNotExist(err) {\n\t// retry transient errors before failing\n\tif isTransient(err) { return t.loadFrom(ctx, base) }\n\treturn err\n}","preventionTips":["Don't mutate (delete/replace) objects in the template bucket while kops runs","Ensure IAM/ACL grants include read on all objects under the base prefix","Re-run commands on transient network failures","Rebuild kops if embedded gobindata assets are suspected corrupt"],"tags":["vfs","templates","io"],"backgroundTag":"vfs-read-failed","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"}