{"record":{"id":"4c06f7faa2693142","repo":"kubernetes/kops","slug":"error-reading-addons-file-s-v","errorCode":null,"errorMessage":"error reading addons file %s: %v","messagePattern":"error reading addons file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/controllerclientset/addons.go","lineNumber":64,"sourceCode":"\t\tcluster:  cluster,\n\t}\n\n\treturn r\n}\n\nfunc (c *addonsClient) Replace(addons kubemanifest.ObjectList) error {\n\treturn fmt.Errorf(\"server-side addons client does not support Addons::Replace\")\n}\n\nfunc (c *addonsClient) List(ctx context.Context) (kubemanifest.ObjectList, error) {\n\tconfigPath := c.basePath.Join(\"default\")\n\n\tb, err := configPath.ReadFile(ctx)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error reading addons file %s: %v\", configPath, err)\n\t}\n\n\tobjects, err := kubemanifest.LoadObjectsFrom(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn objects, nil\n}\n","sourceCodeStart":46,"sourceCodeEnd":74,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/controllerclientset/addons.go#L46-L74","documentation":"The addons List implementation reads a local addons manifest file (under the configured basePath) and failed with an error other than os.IsNotExist, so it cannot return the addons objects. The underlying read error is embedded in the message with the full path.","triggerScenarios":"configPath.ReadFile(ctx) in addonsClient.List fails with a non-notexist error (permission denied, is-a-directory, I/O error); notexist is tolerated and returns nil,nil.","commonSituations":"Addons file mounted with wrong permissions in the controller pod; basePath pointing at a bad volume mount; file replaced by a directory or unreadable due to read-only/broken mount.","solutions":["Check file permissions/ownership on the addons file at the printed path","Verify the volume mount providing the addons directory in the kops-controller pod","Confirm the path exists as a regular file, not a directory","If addons are optional, ensure only missing files are tolerated and fix the real I/O error"],"exampleFix":"// before\nb, err := configPath.ReadFile(ctx)\nif err != nil {\n\treturn nil, fmt.Errorf(\"error reading addons file %s: %v\", configPath, err)\n}\n// after: also tolerate benign errors, log with %w for wrapping\nb, err := configPath.ReadFile(ctx)\nif err != nil {\n\tif os.IsNotExist(err) {\n\t\treturn nil, nil\n\t}\n\treturn nil, fmt.Errorf(\"error reading addons file %s: %w\", configPath, err)\n}","handlingStrategy":"try-catch","validationCode":"// pre-check file accessibility before List\nif info, err := os.Stat(addonsPath); err == nil && info.IsDir() {\n\treturn fmt.Errorf(\"addons path %s is a directory\", addonsPath)\n}","typeGuard":null,"tryCatchPattern":"objects, err := addonsClient.List(ctx)\nif err != nil {\n\tif strings.Contains(err.Error(), \"error reading addons file\") {\n\t\tsetupLog.Error(err, \"addons file unreadable; check mount/permissions\")\n\t}\n\treturn err\n}","preventionTips":["Mount the addons directory read-only but world-readable in the pod","Keep addons payloads as regular files, not directories","Verify volume mounts after any deployment config change"],"tags":["addons","file-io","filesystem"],"backgroundTag":"file-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"}