quickwit-oss/quickwit · error · io::Error (InvalidInput)
the filename limit is too small
Error message
the filename limit is too small
What it means
TempDirectory builds a truncated filename from path parts, separators, and a random suffix while respecting a maximum length. `prefix` requires enough budget to keep at least one character from each part plus separators plus the random chars; if `max_length` is smaller than that minimum, it cannot construct a valid name and throws this io::Error with InvalidInput kind.
Source
Thrown at quickwit/quickwit-common/src/temp_dir.rs:144
}
/// Constructs the prefix from the parts specified by the join function.
/// If parts are small enough they will be simply concatenated with the
/// separator character in between. If parts are too large they will
/// truncated by replacing the middle of each part with "..". The resulting
/// string will be at most max_length characters long.
fn prefix(&self) -> io::Result<String> {
if self.parts.is_empty() {
return Ok(String::new());
}
let separator_count = if self.num_rand_chars > 0 {
self.parts.len()
} else {
self.parts.len() - 1
};
// We want to preserve at least one letter from each part with separators.
if self.max_length < self.parts.len() + separator_count + self.num_rand_chars {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"the filename limit is too small",
));
}
// Calculate how many characters from the parts we can use in the final string.
let len_without_separators = self.max_length - separator_count - self.num_rand_chars;
// Calculate how many characters per part can we use.
let average_len = len_without_separators / self.parts.len();
// Account for the average length may not be a whole number.
let mut leftovers = len_without_separators % self.parts.len();
// We will have some long parts and some short parts. The short parts (part shorter
// than average can "donate" their space to the large parts. That will allows us to
// use all available space. In this loop we are counting how many characters large
// parts can use in addition to the average.
for part in &self.parts {
if part.len() <= average_len {
// Adjust the available length from the parts that are shorter
leftovers += average_len - part.len();View on GitHub (pinned to a39730c5cd)
Solutions
- Increase `max_length` on the prefix builder to at least parts + separators + random-char budget.
- Reduce the number of parts in the prefix path so each can contribute at least one character.
- Fall back to the OS default temp directory naming if the filesystem cannot accommodate the requested limit.
Example fix
// before let prefix = TempPrefix::new(parts).with_max_length(3); // after let prefix = TempPrefix::new(parts).with_max_length(parts.len() + parts.len() - 1 + prefix.num_rand_chars());
Defensive patterns
Strategy: validation
Validate before calling
let min_len = parts.len() + parts.len().saturating_sub(1) + num_rand_chars; let max_length = max_length.max(min_len); // ensure enough budget before calling prefix()
Try / catch
let prefix = match builder.build() {
Ok(p) => p,
Err(e) if e.kind() == io::ErrorKind::InvalidInput
&& e.to_string().contains("filename limit is too small") =>
{
builder.with_max_length(255).build()? // retry with filesystem max
}
Err(e) => return Err(e.into()),
}; Prevention
- Query the filesystem's max filename length and clamp max_length to it before building the prefix.
- Keep temp path prefixes shallow (few parts) on constrained filesystems.
- Reserve room for separators and random suffix characters when computing the limit.
When it happens
Trigger: Calling TempDirectory's `prefix` builder with a `max_length` too small for the number of path parts — e.g. a very low filename limit combined with a deeply nested or many-part path prefix.
Common situations: Filesystems with tight filename limits; users setting an artificially small max filename length; temp prefixes derived from long multi-segment paths on constrained systems.
Related errors
- couldn't find parent for {}
- split folder name should match the format `<split_id>.split`
- body stream ended with {} bytes pending; expected {target}
- body stream ended after skipping {copied} bytes; expected to
- invalid split recovery metadata magic number
AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08).
Data as JSON: /api/errors/2332e41213d09b0e.
Report an issue: GitHub.