{"record":{"id":"2d000b027b2bd31f","repo":"reflex-dev/reflex","slug":"the-content-disposition-header-field-name-must-b","errorCode":null,"errorMessage":"The Content-Disposition header field \"name\" must be provided.","messagePattern":"The Content-Disposition header field \"name\" must be provided\\.","errorType":"exception","errorClass":"MultiPartException","httpStatus":null,"severity":"error","filePath":"packages/reflex-components-core/src/reflex_components_core/core/_upload.py","lineNumber":394,"sourceCode":"            self._current_partial_header_value,\n        ))\n        self._current_partial_header_name = b\"\"\n        self._current_partial_header_value = b\"\"\n\n    def on_headers_finished(self) -> None:\n        \"\"\"Parse upload metadata from multipart headers.\"\"\"\n        disposition, options = parse_options_header(\n            self._current_part.content_disposition\n        )\n        if disposition != b\"form-data\":\n            msg = \"Invalid upload chunk disposition.\"\n            raise MultiPartException(msg)\n\n        try:\n            field_name = _user_safe_decode(options[b\"name\"], self._charset)\n        except KeyError as err:\n            msg = 'The Content-Disposition header field \"name\" must be provided.'\n            raise MultiPartException(msg) from err\n\n        if b\"filename\" not in options:\n            # Capture the bound-args field; ignore any other non-file field.\n            if field_name == UPLOAD_EVENT_ARGS_FIELD:\n                if self._seen_upload_chunk:\n                    # The handler is dispatched at the first file part, so a late\n                    # args field would be silently dropped; reject it loudly.\n                    msg = \"Upload event args must precede the file parts.\"\n                    raise MultiPartException(msg)\n                self._current_part.is_text_field = True\n                self._args_buffer = bytearray()\n            return\n        if field_name == UPLOAD_EVENT_ARGS_FIELD:\n            # A file under the args field name would otherwise be pushed as a\n            # phantom file upload; reject it instead of silently dropping it.\n            msg = \"Upload event args must be a text field, not a file.\"\n            raise MultiPartException(msg)\n        filename = _sanitize_upload_filename(","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-components-core/src/reflex_components_core/core/_upload.py#L376-L412","documentation":"Every multipart part must carry a name option in its Content-Disposition header so the parser can identify fields. A missing options[b\"name\"] raises MultiPartException chained from the KeyError.","triggerScenarios":"A part whose header is `Content-Disposition: form-data` without `; name=\"field\"`, typically from hand-crafted multipart bodies or buggy HTTP clients.","commonSituations":"Manually assembled multipart bodies in tests or scripts; malformed bodies from load balancers; clients that omit name for file-only parts (invalid per RFC 7578).","solutions":["Always include name= in each part: Content-Disposition: form-data; name=\"files\"; filename=\"a.txt\"","Use standard multipart libraries (requests files=, browser FormData) which always emit name","Validate/repair multipart construction in custom upload clients"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert b\"name\" in options, \"each part needs a name\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use browser FormData or requests files= which always include name","Validate custom multipart construction against RFC 7578"],"tags":["upload","multipart","header-validation"],"backgroundTag":"multipart-validation-failed","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}