{"record":{"id":"202c6c589807d51d","repo":"influxdata/influxdb","slug":"error-decoding-multipart-file-upload-0","errorCode":null,"errorMessage":"error decoding multipart file upload: {0}","messagePattern":"error decoding multipart file upload: (.+?)","errorType":"http","errorClass":"Error::MultipartFile","httpStatus":null,"severity":"error","filePath":"core/iox_v1_query_api/src/error.rs","lineNumber":32,"sourceCode":"pub struct QueryError(#[from] pub anyhow::Error);\n\n#[derive(Debug, Error)]\npub enum Error {\n    /// The requested path has no registered handler.\n    #[error(\"not found: {0}\")]\n    NoHandler(String),\n\n    #[error(\"authorization failure: {0}\")]\n    AuthorizationFailure(String),\n\n    #[error(\"invalid mime type ({0})\")]\n    InvalidMimeType(String),\n\n    /// Missing parameters for query\n    #[error(\"missing query parameters 'db' and 'q'\")]\n    MissingQueryParams,\n\n    #[error(\"error decoding multipart file upload: {0}\")]\n    MultipartFile(String),\n\n    #[error(\"Invalid UTF8: {message} {error}\")]\n    Utf8 {\n        message: &'static str,\n        error: String,\n    },\n\n    /// Serde decode error\n    #[error(\"error decoding params from url: {0}\")]\n    SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),\n\n    // SerdeJsonError\n    #[error(\"error decoding query body: {0}\")]\n    SerdeJson(#[from] serde_json::Error),\n\n    #[error(\"datafusion error: {0}\")]\n    Datafusion(#[from] DataFusionError),","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_v1_query_api/src/error.rs#L14-L50","documentation":"`Error::MultipartFile(String)` reports a failure while decoding a multipart file upload in the v1 API. When a request submits line-protocol or other data as a multipart form part, any parse/decode failure of that part is wrapped in this error with the underlying detail.","triggerScenarios":"POSTing data via multipart/form-data where a part cannot be decoded — wrong field name, corrupt or non-UTF8 payload, or missing file part entirely.","commonSituations":"curl `-F` uploads with incorrect part names, CSV/line-protocol files with encoding problems, or clients that send multipart when the server expects a plain body.","solutions":["Check the multipart field name matches what the API expects.","Validate the uploaded file is well-formed line protocol and correctly encoded (UTF-8).","Fall back to a non-multipart raw body upload if multipart is not required."],"exampleFix":"// before\n-F 'data=@points.txt'   // wrong field name\n// after\n-F 'file=@points.txt'   // expected part name","handlingStrategy":"validation","validationCode":"fn multipart_upload_ok(file: &[u8]) -> Result<(), String> {\n    if file.is_empty() { return Err(\"empty file part\".into()); }\n    std::str::from_utf8(file).map_err(|e| e.to_string())?;\n    Ok(())\n}","typeGuard":"fn is_multipart_error(e: &iox_v1_query_api::Error) -> Option<&str> {\n    match e { iox_v1_query_api::Error::MultipartFile(m) => Some(m), _ => None }\n}","tryCatchPattern":"multipart_upload_ok(&file_bytes)?;\nlet form = reqwest::multipart::Form::new().part(\"file\", reqwest::multipart::Part::bytes(file_bytes));\nlet resp = client.post(\"/write\").multipart(form).send().await?;","preventionTips":["Verify the multipart field name against the API docs before each release.","Pre-validate uploads (non-empty, UTF-8, expected line-protocol format) client-side.","Prefer plain raw-body uploads when multipart is not strictly required."],"tags":["rust","http-api","multipart","file-upload","thiserror"],"backgroundTag":"json-decode-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}