{"record":{"id":"fff0465b1bb239c3","repo":"helm/helm","slug":"chart-file-q-is-larger-than-the-maximum-file-size-fff046","errorCode":null,"errorMessage":"chart file %q is larger than the maximum file size %d","messagePattern":"chart file %q is larger than the maximum file size (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/chart/v2/loader/directory.go","lineNumber":104,"sourceCode":"\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// If a .helmignore file matches, skip this file.\n\t\tif rules.Ignore(n, fi) {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Irregular files include devices, sockets, and other uses of files that\n\t\t// are not regular files. In Go they have a file mode type bit set.\n\t\t// See https://golang.org/pkg/os/#FileMode for examples.\n\t\tif !fi.Mode().IsRegular() {\n\t\t\treturn fmt.Errorf(\"cannot load irregular file %s as it has file mode type bits set\", name)\n\t\t}\n\n\t\tif fi.Size() > archive.MaxDecompressedFileSize {\n\t\t\treturn fmt.Errorf(\"chart file %q is larger than the maximum file size %d\", fi.Name(), archive.MaxDecompressedFileSize)\n\t\t}\n\n\t\tdata, err := os.ReadFile(name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading %s: %w\", n, err)\n\t\t}\n\n\t\tdata = bytes.TrimPrefix(data, utf8bom)\n\n\t\tfiles = append(files, &archive.BufferedFile{Name: n, ModTime: fi.ModTime(), Data: data})\n\t\treturn nil\n\t}\n\tif err := sympath.Walk(topdir, walk); err != nil {\n\t\treturn c, err\n\t}\n\n\treturn LoadFiles(files)\n}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/helm/helm/blob/2a29f1770b62844b27197d2507377361d45ad7c0/pkg/chart/v2/loader/directory.go#L86-L122","documentation":"Returned by loader.LoadDir's walker when a file inside the chart directory exceeds archive.MaxDecompressedFileSize (pkg/chart/loader/archive; default 5 MiB, an int64 package variable). This mirrors the decompression-bomb guard used when loading archives and stops the loader from buffering oversized files into memory. The message includes the file name and the enforced limit.","triggerScenarios":"Calling loader.LoadDir on a chart containing any single file > 5 MiB by default — large images, binaries, CSV/JSON datasets, or model files placed in the chart; also triggered when the limit variable was lowered programmatically.","commonSituations":"Charts that bundle static assets (fonts, GeoIP databases, ML models); generated CRD or data files exceeding 5 MiB; forgetting that 'files are small in dev, huge in prod data' after pointing the chart at a big dataset.","solutions":["Identify the oversized file named in the error and shrink or split it below the limit (compress, trim data, or move hosting to an object store/ConfigMap-free delivery).","If the large file is legitimately part of the chart, raise the guard in your program before loading: `archive.MaxDecompressedFileSize = 50 * 1024 * 1024` (it exists to protect memory, so size it consciously).","Check for accidentally committed build artifacts or test fixtures and remove them from the chart directory.","Re-run the load after the change."],"exampleFix":"// before\nimport \"helm.sh/helm/v4/pkg/chart/v2/loader\"\nc, err := loader.LoadDir(\"./mychart\") // 12 MiB bundled dataset -> error\n\n// after\nimport \"helm.sh/helm/v4/pkg/chart/loader/archive\"\narchive.MaxDecompressedFileSize = 20 * 1024 * 1024 // raise guard deliberately\nc, err := loader.LoadDir(\"./mychart\")","handlingStrategy":"validation","validationCode":"// pre-walk: verify every file is under the limit you will load with\nfunc sizesOK(root string, limit int64) error {\n    return filepath.WalkDir(root, func(p string, d fs.DirEntry, err error) error {\n        if err != nil { return err }\n        if d.IsDir() { return nil }\n        fi, err := d.Info()\n        if err != nil { return err }\n        if fi.Size() > limit { return fmt.Errorf(\"%s is %d bytes (> %d)\", p, fi.Size(), limit) }\n        return nil\n    })\n}","typeGuard":"func isFileSizeErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"larger than the maximum file size\")\n}","tryCatchPattern":"c, err := loader.LoadDir(dir)\nif err != nil && strings.Contains(err.Error(), \"larger than the maximum file size\") {\n    // either shrink/split the named file, or consciously raise archive.MaxDecompressedFileSize and retry\n}","preventionTips":["Keep bundled assets out of charts (host them externally); charts are metadata, not data stores.","If big files are unavoidable, set archive.MaxDecompressedFileSize explicitly at startup rather than discovering the default at load time."],"tags":["helm","loader","file-size","limits","memory-safety"],"backgroundTag":null,"analyzedSha":"2a29f1770b62844b27197d2507377361d45ad7c0","analyzedAt":"2026-08-15T22:02:47.490Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}