quickwit-oss/quickwit · error

cannot join URI ` ` with absolute path

Error message

cannot join URI `{}` with absolute path `{:?}`

What it means

`Uri::join` was asked to adjoin a path to an existing URI, but the given path is absolute (starts with `/`). Joining would discard the URI's base path, so the guard rejects it before constructing the joined URI string. Callers are `default_metastore_uri`/`default_index_root_uri` building default paths.

Solutions

  1. Pass a relative path to `join` instead of an absolute one
  2. Build a complete URI from scratch if an absolute location is intended
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at quickwit/quickwit-common/src/uri.rs:226 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/cb0436bfa16f18c0. Report an issue: GitHub.

Appendix: source

Thrown at quickwit/quickwit-common/src/uri.rs:226

        if self.protocol() == Protocol::Azure && path.components().count() < 3 {
            return None;
        }
        if self.protocol() == Protocol::Google && path.components().count() < 2 {
            return None;
        }
        path.file_name().map(Path::new)
    }

    /// Consumes the [`Uri`] struct and returns the normalized URI as a string.
    pub fn into_string(self) -> String {
        self.uri
    }

    /// Creates a new [`Uri`] with `path` adjoined to `self`.
    /// Fails if `path` is absolute.
    pub fn join<P: AsRef<Path> + std::fmt::Debug>(&self, path: P) -> anyhow::Result<Self> {
        if path.as_ref().is_absolute() {
            bail!(
                "cannot join URI `{}` with absolute path `{:?}`",
                self.uri,
                path
            );
        }
        let joined = match self.protocol() {
            Protocol::File => Path::new(&self.uri)
                .join(path)
                .to_string_lossy()
                .to_string(),
            Protocol::PostgreSQL => bail!(
                "cannot join PostgreSQL URI `{}` with path `{:?}`",
                self.uri,
                path
            ),
            _ => format!(
                "{}{}{}",
                self.uri,

View on GitHub (pinned to a39730c5cd)