openai/codex · error · PathUriParseError

path ` ` must be relative when joining a path URI

Error message

path `{0}` must be relative when joining a path URI

What it means

The MustBeRelative variant of PathUriParseError raised by PathUri::join: the argument path is absolute. join appends a relative sub-path to an existing URI; an absolute argument would replace the base, so it is rejected and the caller must use from_abs_path instead.

Solutions

  1. Pass a relative sub-path (strip the root component) to join
  2. Build a fresh PathUri from the absolute path via from_abs_path
  3. Compute the relative remainder against the URI's base before joining
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/utils/path-uri/src/lib.rs:896 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/ea0630efd17bb0b7. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/utils/path-uri/src/lib.rs:896

}

#[derive(Debug, Error, PartialEq, Eq)]
pub enum PathUriParseError {
    #[error("invalid URI: {0}")]
    InvalidUri(#[from] url::ParseError),
    #[error("unsupported path URI scheme `{0}`")]
    UnsupportedScheme(String),
    #[error("'{path}' is invalid on '{os}'", os = std::env::consts::OS)]
    InvalidFileUriPath { path: String },
    #[error("credentials are not allowed in path URIs")]
    CredentialsNotAllowed,
    #[error("ports are not allowed in path URIs")]
    PortNotAllowed,
    #[error("query parameters are not allowed in path URIs")]
    QueryNotAllowed,
    #[error("fragments are not allowed in path URIs")]
    FragmentNotAllowed,
    #[error("path `{0}` must be relative when joining a path URI")]
    JoinPathMustBeRelative(String),
}

/// Path syntax used to render a [`PathUri`] as an operating-system path.
///
/// This describes path grammar rather than a specific operating system because
/// Linux and macOS share the POSIX representation relevant here.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "snake_case")]
#[ts(rename_all = "snake_case")]
pub enum PathConvention {
    Posix,
    Windows,
}

impl PathConvention {
    /// Returns the path convention used by the current process.
    #[cfg(windows)]

View on GitHub (pinned to 339751715c)