{"record":{"id":"65addba77bc99a14","repo":"theonedev/onedev","slug":"chart-yaml-is-too-large","errorCode":null,"errorMessage":"Chart.yaml is too large","messagePattern":"Chart\\.yaml is too large","errorType":"http","errorClass":"ClientException","httpStatus":400,"severity":"error","filePath":"server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java","lineNumber":195,"sourceCode":"            } else {\n                try (var is = request.getInputStream()) {\n                    var copied = IOUtils.copyWithMaxSize(is, baos, MAX_FILE_SIZE);\n                    if (copied == -1)\n                        throw new ClientException(SC_NOT_ACCEPTABLE, \"Chart archive exceeds maximum size: \" + MAX_FILE_SIZE);\n                } catch (IOException e) {\n                    throw new RuntimeException(e);\n                }    \n            }\n            Map<String, Object> metadata = null;\n            var bytes = baos.toByteArray();\n\n            try (var is = new TarInputStream(new GZIPInputStream(new ByteArrayInputStream(bytes)))) {\n                TarEntry entry;\n                while ((entry = is.getNextEntry()) != null) {\n                    String entryName = entry.getName();\n                    if (entryName.equals(\"Chart.yaml\") || entryName.endsWith(\"/Chart.yaml\")) {\n                        if (entry.getSize() > MAX_FILE_SIZE)\n                            throw new ClientException(SC_BAD_REQUEST, \"Chart.yaml is too large\");\n                        byte[] content = new byte[(int) entry.getSize()];\n                        is.read(content);\n                        var options = new LoaderOptions();\n                        metadata = new Yaml(new SafeConstructor(options)).load(new ByteArrayInputStream(content));\n                        break;\n                    }\n                }                \n            } catch (IOException e) {\n                throw new ClientException(SC_BAD_REQUEST, \"Error reading chart archive: \" + e.getMessage());\n            }\n\n            if (metadata == null) {\n                throw new ClientException(SC_BAD_REQUEST, \"Chart.yaml not found in the archive\");\n            }\n            \n            var chartName = (String) metadata.get(\"name\");\n            var chartVersion = (String) metadata.get(\"version\");\n            ","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java#L177-L213","documentation":"After unpacking the uploaded chart tarball in memory, HelmPackHandler scans entries for Chart.yaml (at root or any directory depth). If the matching entry's declared size exceeds MAX_FILE_SIZE, it throws ClientException with HTTP 400 rather than loading it into the YAML parser — a defensive limit against pathological Chart.yaml files.","triggerScenarios":"Publishing a chart whose Chart.yaml (entry.getSize()) is larger than MAX_FILE_SIZE — e.g. generated Chart.yaml with thousands of appended values, embedded data blobs, or a crafted/oversized file.","commonSituations":"Templating mistakes that dump large data into Chart.yaml; mis-built charts where Chart.yaml was overwritten by a values file; malicious uploads attempting resource exhaustion via huge YAML files.","solutions":["Inspect and clean Chart.yaml so it is a small, normal chart metadata file (name, version, apiVersion, dependencies).","Move large data into values.yaml or separate files instead of Chart.yaml.","Repackage: helm package . after fixing, then re-push.","If legitimately large metadata is required, increase MAX_FILE_SIZE in HelmPackHandler and redeploy the plugin."],"exampleFix":"// before (Chart.yaml bloated with embedded data)\napiVersion: v2\nname: mychart\nversion: 0.1.0\n# ...3 MB of dumped config...\n// after\napiVersion: v2\nname: mychart\nversion: 0.1.0\ndescription: chart metadata kept small\n","handlingStrategy":"validation","validationCode":"# ensure Chart.yaml is small and well-formed before packaging\n[ $(stat -c%s Chart.yaml) -le 10485760 ] || { echo 'Chart.yaml too large'; exit 1; }\nhelm lint . && helm package .","typeGuard":null,"tryCatchPattern":"try {\n    helmPush(chartTgz);\n} catch (ClientException e) {\n    if (String(e).contains('Chart.yaml is too large')) throw new IllegalStateException(\"Chart.yaml must be a small metadata file\", e);\n    throw e;\n}","preventionTips":["Keep only chart metadata (apiVersion, name, version, dependencies) in Chart.yaml.","Run `helm lint` before packaging to catch malformed Chart.yaml.","Never generate or overwrite Chart.yaml with data dumps in build scripts."],"tags":["helm","yaml","file-size-limit","chart"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}