{"record":{"id":"a45bbe5b301023de","repo":"quickwit-oss/quickwit","slug":"failed-to-parse-empty-uri","errorCode":null,"errorMessage":"failed to parse empty URI","messagePattern":"failed to parse empty URI","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-common/src/uri.rs","lineNumber":263,"sourceCode":"                if self.uri.ends_with('/') { \"\" } else { \"/\" },\n                path.as_ref().display(),\n            ),\n        };\n        Ok(Self {\n            uri: joined,\n            protocol: self.protocol,\n        })\n    }\n\n    /// Attempts to construct a [`Uri`] from a string.\n    /// A `file://` protocol is assumed if not specified.\n    /// File URIs are resolved (normalized) relative to the current working directory\n    /// unless an absolute path is specified.\n    /// Handles special characters such as `~`, `.`, `..`.\n    fn parse_str(uri_str: &str) -> anyhow::Result<Self> {\n        // CAUTION: Do not display the URI in error messages to avoid leaking credentials.\n        if uri_str.is_empty() {\n            bail!(\"failed to parse empty URI\");\n        }\n        let (protocol, mut path) = match uri_str.split_once(PROTOCOL_SEPARATOR) {\n            None => (Protocol::File, uri_str.to_string()),\n            Some((protocol, path)) => (Protocol::from_str(protocol)?, path.to_string()),\n        };\n        if protocol == Protocol::File {\n            if path.starts_with('~') {\n                // We only accept `~` (alias to the home directory) and `~/path/to/something`.\n                // If there is something following the `~` that is not `/`, we bail.\n                if path.len() > 1 && !path.starts_with(\"~/\") {\n                    bail!(\"failed to normalize URI: tilde expansion is only partially supported\");\n                }\n\n                let home_dir_path = home::home_dir()\n                    .context(\"failed to normalize URI: could not resolve home directory\")?\n                    .to_string_lossy()\n                    .to_string();\n","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-common/src/uri.rs#L245-L281","documentation":"`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.","triggerScenarios":"Thrown at quickwit/quickwit-common/src/uri.rs:263 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}