theonedev/onedev · error · ClientException

Chart archive exceeds maximum size: ${MAX_FILE_SIZE}

Error message

Chart archive exceeds maximum size: ${MAX_FILE_SIZE}

What it means

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.

Source

Thrown at server-plugin/server-plugin-pack-helm/src/main/java/io/onedev/server/plugin/pack/helm/HelmPackHandler.java:167

            } else {
                response.setStatus(SC_NOT_FOUND);
            }
        } else if (request.getMethod().equals("POST")) {            
            sessionService.run(() -> {
                checkProject(projectId, true);
            });
            var baos = new ByteArrayOutputStream();
            var contentType = request.getHeader("Content-Type");
            if (contentType != null && (contentType.contains("multipart/form-data") || contentType.contains("application/x-www-form-urlencoded"))) {
                try {
                    var upload = new ServletFileUpload();
                    var items = upload.getItemIterator(request);
                    if (items.hasNext()) {
                        var item = items.next();
                        try (var is = item.openStream()) {
                            var copied = IOUtils.copyWithMaxSize(is, baos, MAX_FILE_SIZE);
                            if (copied == -1)
                                throw new ClientException(SC_NOT_ACCEPTABLE, "Chart archive exceeds maximum size: " + MAX_FILE_SIZE);
                        } catch (IOException e) {
                            throw new RuntimeException(e);
                        }
                    } else {
                        throw new ClientException(SC_BAD_REQUEST, "Chart archive not found");
                    }
                } catch (FileUploadException|IOException e) {
                    throw new RuntimeException(e);
                }
            } else {
                try (var is = request.getInputStream()) {
                    var copied = IOUtils.copyWithMaxSize(is, baos, MAX_FILE_SIZE);
                    if (copied == -1)
                        throw new ClientException(SC_NOT_ACCEPTABLE, "Chart archive exceeds maximum size: " + MAX_FILE_SIZE);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }    
            }

View on GitHub (pinned to d44925c47c)

Solutions

  1. Reduce the chart size: remove vendored charts (helm dependency build -> use repository refs), strip unneeded files, or split large assets.
  2. Repackage the chart: helm package . and confirm the resulting .tgz size before pushing.
  3. Increase MAX_FILE_SIZE in HelmPackHandler if your deployment policy allows larger charts, then rebuild the plugin.
  4. Verify you are pushing the intended, final chart archive rather than a debug/source archive.

Example fix

// before
private static final int MAX_FILE_SIZE = 10 * 1024 * 1024;
// after
private static final int MAX_FILE_SIZE = 50 * 1024 * 1024;
Defensive patterns

Strategy: validation

Validate before calling

# check chart archive size before pushing
ls -lh mychart-0.1.0.tgz
# abort if above limit (adjust MAX to your deployment's limit)
[ $(stat -c%s mychart-0.1.0.tgz) -le 10485760 ] || { echo 'chart too large'; exit 1; }

Try / catch

try {
    helmPush(chartTgz);
} catch (ClientException e) {
    if (String(e).contains('exceeds maximum size')) throw new IllegalArgumentException("Shrink chart or raise MAX_FILE_SIZE", e);
    throw e;
}

Prevention

When it happens

Trigger: helm push (or multipart POST to the helm pack endpoint) with a .tgz chart whose size exceeds MAX_FILE_SIZE.

Common situations: 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.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/603a1a89c1bc6b72. Report an issue: GitHub.