quickwit-oss/quickwit · error
failed to parse empty URI
Error message
failed to parse empty URI
What it means
`Uri::parse_str` received an empty (zero-length) string as the URI to construct. Since there is no protocol, host, or path to infer, parsing is refused immediately — note the code deliberately does not echo the URI to avoid leaking credentials.
Solutions
- Provide a non-empty URI string, e.g. `file:///path` or `s3://bucket/path`
- Check for empty environment variables or config values feeding the URI
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at quickwit/quickwit-common/src/uri.rs:263 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08).
Data as JSON: /api/errors/a45bbe5b301023de.
Report an issue: GitHub.
Appendix: source
Thrown at quickwit/quickwit-common/src/uri.rs:263
if self.uri.ends_with('/') { "" } else { "/" },
path.as_ref().display(),
),
};
Ok(Self {
uri: joined,
protocol: self.protocol,
})
}
/// Attempts to construct a [`Uri`] from a string.
/// A `file://` protocol is assumed if not specified.
/// File URIs are resolved (normalized) relative to the current working directory
/// unless an absolute path is specified.
/// Handles special characters such as `~`, `.`, `..`.
fn parse_str(uri_str: &str) -> anyhow::Result<Self> {
// CAUTION: Do not display the URI in error messages to avoid leaking credentials.
if uri_str.is_empty() {
bail!("failed to parse empty URI");
}
let (protocol, mut path) = match uri_str.split_once(PROTOCOL_SEPARATOR) {
None => (Protocol::File, uri_str.to_string()),
Some((protocol, path)) => (Protocol::from_str(protocol)?, path.to_string()),
};
if protocol == Protocol::File {
if path.starts_with('~') {
// We only accept `~` (alias to the home directory) and `~/path/to/something`.
// If there is something following the `~` that is not `/`, we bail.
if path.len() > 1 && !path.starts_with("~/") {
bail!("failed to normalize URI: tilde expansion is only partially supported");
}
let home_dir_path = home::home_dir()
.context("failed to normalize URI: could not resolve home directory")?
.to_string_lossy()
.to_string();
View on GitHub (pinned to a39730c5cd)