openai/codex · error · io::Error

' ' is invalid on

Error message

'{path}' is invalid on '{os}'

What it means

The InvalidFileUriPath variant of PathUriParseError raised during PathUri::join: the file URI's path component is not valid under the current host OS (std::env::consts::OS is included in the message). This guards conversion of URIs whose decoded path contains bytes or structure the native path API cannot represent, such as embedded NULs.

Solutions

  1. Strip or percent-encode invalid bytes (especially NUL) in the URI path
  2. Rebuild the URI from a native absolute path known valid on this OS
  3. Reject the URI at input validation before attempting join
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/utils/path-uri/src/lib.rs:503 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/6b39ef4d6366c83e. Report an issue: GitHub.

Appendix: source

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

                    component => {
                        segments.push(component);
                        depth += 1;
                    }
                }
            }
        }
        Self::try_from(url)
    }

    /// Converts this file URI to a path using the current host's path rules.
    ///
    /// The URI's inferred path convention must match the current host. Conversion should succeed
    /// when the URI was created from an [`AbsolutePathBuf`] on the current host, including fallback
    /// URIs created by [`Self::from_abs_path`]. Foreign conventions are rejected rather than being
    /// projected onto a syntactically valid but unrelated host path.
    pub fn to_abs_path(&self) -> io::Result<AbsolutePathBuf> {
        if self.infer_path_convention() != Some(PathConvention::native()) {
            return Err(io::Error::new(
                io::ErrorKind::InvalidInput,
                PathUriParseError::InvalidFileUriPath {
                    path: self.to_string(),
                },
            ));
        }
        if let Some(path_bytes) = decode_bad_path_uri(&self.0) {
            #[cfg(unix)]
            let decoded_path = {
                use std::os::unix::ffi::OsStringExt;
                Some(std::path::PathBuf::from(std::ffi::OsString::from_vec(
                    path_bytes,
                )))
            };
            #[cfg(windows)]
            let decoded_path = {
                use std::os::windows::ffi::OsStringExt;
                path_bytes.len().is_multiple_of(2).then(|| {

View on GitHub (pinned to 339751715c)