influxdata/influxdb · error · Error::MultipartFile
error decoding multipart file upload
Error message
error decoding multipart file upload: {0} What it means
`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.
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.
Example fix
// before -F 'data=@points.txt' // wrong field name // after -F 'file=@points.txt' // expected part name
Defensive patterns
Strategy: validation
Validate before calling
fn multipart_upload_ok(file: &[u8]) -> Result<(), String> {
if file.is_empty() { return Err("empty file part".into()); }
std::str::from_utf8(file).map_err(|e| e.to_string())?;
Ok(())
} Type guard
fn is_multipart_error(e: &iox_v1_query_api::Error) -> Option<&str> {
match e { iox_v1_query_api::Error::MultipartFile(m) => Some(m), _ => None }
} Try / catch
multipart_upload_ok(&file_bytes)?;
let form = reqwest::multipart::Form::new().part("file", reqwest::multipart::Part::bytes(file_bytes));
let resp = client.post("/write").multipart(form).send().await?; Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- authorization failure
- error decoding params from url
- error decoding query body
- invalid mime type ( )
- Invalid UTF8
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/202c6c589807d51d.
Report an issue: GitHub.
Appendix: source
Thrown at core/iox_v1_query_api/src/error.rs:32
pub struct QueryError(#[from] pub anyhow::Error);
#[derive(Debug, Error)]
pub enum Error {
/// The requested path has no registered handler.
#[error("not found: {0}")]
NoHandler(String),
#[error("authorization failure: {0}")]
AuthorizationFailure(String),
#[error("invalid mime type ({0})")]
InvalidMimeType(String),
/// Missing parameters for query
#[error("missing query parameters 'db' and 'q'")]
MissingQueryParams,
#[error("error decoding multipart file upload: {0}")]
MultipartFile(String),
#[error("Invalid UTF8: {message} {error}")]
Utf8 {
message: &'static str,
error: String,
},
/// Serde decode error
#[error("error decoding params from url: {0}")]
SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),
// SerdeJsonError
#[error("error decoding query body: {0}")]
SerdeJson(#[from] serde_json::Error),
#[error("datafusion error: {0}")]
Datafusion(#[from] DataFusionError),View on GitHub (pinned to 06200ef96b)