{"record":{"id":"603a1a89c1bc6b72","repo":"theonedev/onedev","slug":"chart-archive-exceeds-maximum-size-max-file-siz","errorCode":null,"errorMessage":"Chart archive exceeds maximum size: ${MAX_FILE_SIZE}","messagePattern":"Chart archive exceeds maximum size: (.+?)","errorType":"http","errorClass":"ClientException","httpStatus":406,"severity":"error","filePath":"server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java","lineNumber":167,"sourceCode":"            } else {\n                response.setStatus(SC_NOT_FOUND);\n            }\n        } else if (request.getMethod().equals(\"POST\")) {            \n            sessionService.run(() -> {\n                checkProject(projectId, true);\n            });\n            var baos = new ByteArrayOutputStream();\n            var contentType = request.getHeader(\"Content-Type\");\n            if (contentType != null && (contentType.contains(\"multipart/form-data\") || contentType.contains(\"application/x-www-form-urlencoded\"))) {\n                try {\n                    var upload = new ServletFileUpload();\n                    var items = upload.getItemIterator(request);\n                    if (items.hasNext()) {\n                        var item = items.next();\n                        try (var is = item.openStream()) {\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                    } else {\n                        throw new ClientException(SC_BAD_REQUEST, \"Chart archive not found\");\n                    }\n                } catch (FileUploadException|IOException e) {\n                    throw new RuntimeException(e);\n                }\n            } 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            }","sourceCodeStart":149,"sourceCodeEnd":185,"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#L149-L185","documentation":"HelmPackHandler throws this ClientException (HTTP 406) when a multipart upload of a chart archive is larger than the handler's MAX_FILE_SIZE limit. IOUtils.copyWithMaxSize stops copying and returns -1 once the limit is exceeded, which the handler turns into this error before any bytes are persisted.","triggerScenarios":"helm push (or multipart POST to the helm pack endpoint) with a .tgz chart whose size exceeds MAX_FILE_SIZE.","commonSituations":"Charts bundling large CRDs, manifests, or vendored dependencies (helm dependency build with charts/ vendored); accidentally pushing the wrong archive; team-level size limits raised elsewhere but not matching this handler's constant.","solutions":["Reduce the chart size: remove vendored charts (helm dependency build -> use repository refs), strip unneeded files, or split large assets.","Repackage the chart: helm package . and confirm the resulting .tgz size before pushing.","Increase MAX_FILE_SIZE in HelmPackHandler if your deployment policy allows larger charts, then rebuild the plugin.","Verify you are pushing the intended, final chart archive rather than a debug/source archive."],"exampleFix":"// before\nprivate static final int MAX_FILE_SIZE = 10 * 1024 * 1024;\n// after\nprivate static final int MAX_FILE_SIZE = 50 * 1024 * 1024;","handlingStrategy":"validation","validationCode":"# check chart archive size before pushing\nls -lh mychart-0.1.0.tgz\n# abort if above limit (adjust MAX to your deployment's limit)\n[ $(stat -c%s mychart-0.1.0.tgz) -le 10485760 ] || { echo 'chart too large'; exit 1; }","typeGuard":null,"tryCatchPattern":"try {\n    helmPush(chartTgz);\n} catch (ClientException e) {\n    if (String(e).contains('exceeds maximum size')) throw new IllegalArgumentException(\"Shrink chart or raise MAX_FILE_SIZE\", e);\n    throw e;\n}","preventionTips":["Run `helm dependency update` and avoid vendoring charts into the package.","Check .tgz size in CI before publishing.","Keep large assets out of chart directories (.helmignore)."],"tags":["helm","upload","file-size-limit","package-management"],"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"}