{"record":{"id":"f9b878d436048afe","repo":"quickwit-oss/quickwit","slug":"failed-to-normalize-uri-tilde-expansion-is-only-p","errorCode":null,"errorMessage":"failed to normalize URI: tilde expansion is only partially supported","messagePattern":"failed to normalize URI: tilde expansion is only partially supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-common/src/uri.rs","lineNumber":274,"sourceCode":"    /// 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\n                path.replace_range(0..1, &home_dir_path);\n            }\n            if Path::new(&path).is_relative() {\n                let current_dir = env::current_dir().context(\n                    \"failed to normalize URI: could not resolve current working directory. the \\\n                     directory does not exist or user has insufficient permissions\",\n                )?;\n                path = current_dir.join(path).to_string_lossy().to_string();\n            }\n            path = normalize_path(Path::new(&path))\n                .to_string_lossy()","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-common/src/uri.rs#L256-L292","documentation":"During normalization in `Uri::parse_str`, a `~`-relative path was encountered (e.g. `~user/...`). Only expansion of a bare `~` to the home directory is supported; per-user tilde prefixes like `~otheruser` cannot be resolved portably, so normalization aborts.","triggerScenarios":"Thrown at quickwit/quickwit-common/src/uri.rs:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the tilde with an absolute path, e.g. `/home/user/...`","Use a bare `~` (current user's home) only when it applies","Set the path via environment variables expanded by the shell"],"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"}