{"record":{"id":"b7ebf7a3c736614c","repo":"argoproj/argo-workflows","slug":"request-entity-too-large","errorCode":null,"errorMessage":"Request Entity Too Large","messagePattern":"Request Entity Too Large","errorType":"http","errorClass":null,"httpStatus":413,"severity":"warning","filePath":"server/artifacts/artifact_server.go","lineNumber":165,"sourceCode":"\tif err != nil {\n\t\ta.serverInternalError(ctx, err, w)\n\t\treturn\n\t}\n\tr.Body = http.MaxBytesReader(w, r.Body, int64(maxUploadBytes))\n\n\t// mime/multipart.ReadForm already removes temp files on parse error, but\n\t// registering cleanup here makes the handler's correctness independent of\n\t// that stdlib internal — any future error return still frees temp files.\n\tdefer func() {\n\t\tif r.MultipartForm != nil {\n\t\t\t_ = r.MultipartForm.RemoveAll()\n\t\t}\n\t}()\n\n\t// Parse multipart form (max 32MB in memory, rest on disk)\n\tif parseErr := r.ParseMultipartForm(32 << 20); parseErr != nil {\n\t\tif _, ok := errors.AsType[*http.MaxBytesError](parseErr); ok {\n\t\t\thttp.Error(w, http.StatusText(http.StatusRequestEntityTooLarge), http.StatusRequestEntityTooLarge)\n\t\t\treturn\n\t\t}\n\t\thttp.Error(w, \"Failed to parse multipart form: \"+parseErr.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tfile, header, err := r.FormFile(\"file\")\n\tif err != nil {\n\t\thttp.Error(w, \"Failed to get file from form: \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\ta.logger.WithFields(logging.Fields{\n\t\t\"filename\": header.Filename,\n\t\t\"size\":     header.Size,\n\t}).Info(ctx, \"Received file for upload\")\n","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/artifacts/artifact_server.go#L147-L183","documentation":"The request body size is capped by ARGO_SERVER_MAX_ARTIFACT_UPLOAD_BYTES (default 1GiB) via http.MaxBytesReader. If r.ParseMultipartForm fails specifically with *http.MaxBytesError, the handler responds 413 'Request Entity Too Large'. Other parse failures fall through to a 400.","triggerScenarios":"Uploading an artifact larger than the configured cap; the client not honoring Content-Length limits mid-stream; an intermediary sending a body exceeding the limit.","commonSituations":"Large binaries (datasets, videos) uploaded through the artifact endpoint; operator lowered ARGO_SERVER_MAX_ARTIFACT_UPLOAD_BYTES from the 1GiB default; misconfigured chunked upload that inflates apparent size.","solutions":["Check the file size before upload and reject/truncate oversized files client-side","Raise ARGO_SERVER_MAX_ARTIFACT_UPLOAD_BYTES in the argo-server deployment if larger uploads are intended (document in docs/environment-variables.md)","Compress or split the artifact, or upload via the storage backend (S3/GCS) artifact path instead","Ensure proxies/ingress also allow the intended body size"],"exampleFix":"# before (client sends 2GB file with default 1GiB cap)\ncurl -X POST -F 'file=@huge.bin' ...\n# after\nARGO_SERVER_MAX_ARTIFACT_UPLOAD_BYTES=4294967296  # 4GiB in argo-server env\n# or client-side:\nstat -c%s huge.bin  # verify <= cap before upload","handlingStrategy":"validation","validationCode":"size := fileInfo.Size()\ncap := int64(1 << 30) // or configured ARGO_SERVER_MAX_ARTIFACT_UPLOAD_BYTES\nif size > cap {\n    return fmt.Errorf(\"artifact %d bytes exceeds upload cap %d\", size, cap)\n}","typeGuard":null,"tryCatchPattern":"if resp.StatusCode == http.StatusRequestEntityTooLarge {\n    return fmt.Errorf(\"upload exceeds ARGO_SERVER_MAX_ARTIFACT_UPLOAD_BYTES; compress or split the artifact\")\n}","preventionTips":["Check file size client-side against the configured cap before uploading","Keep server cap and any ingress body limits aligned","Prefer direct artifact storage (S3/GCS) for very large files","Document the env var when raising it so ops know the new limit"],"tags":["http-413","upload-limit","artifacts","http"],"backgroundTag":"request-entity-too-large","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}