openai/codex · error · PathUriParseError
invalid URI
Error message
invalid URI: {0} What it means
The InvalidUri variant of PathUriParseError (wrapping url::ParseError via #[from]): the input string failed RFC 3986 parsing by the url crate before any path-URI-specific checks ran. This is the generic malformed-URI sentinel; the original url crate error identifies the syntax problem.
Solutions
- Fix the URI syntax (scheme, separators, percent-encoding) and re-parse
- Construct the URI via PathUri::from_abs_path instead of hand-writing it
- Percent-encode unsafe characters before parsing
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/utils/path-uri/src/lib.rs:882 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/97e97da5f15a5644.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/utils/path-uri/src/lib.rs:882
/// Applies the common URI checks plus `file:` path-byte restrictions.
fn validate_file_url(url: &Url) -> Result<(), PathUriParseError> {
validate_common_known_uri(url)?;
// `Url` accepts `%00`, but native path APIs use null as a terminator and
// `Url::to_file_path` cannot represent a decoded null byte.
if urlencoding::decode_binary(url.path().as_bytes()).contains(&0)
&& decode_bad_path_uri(url).is_none()
{
return Err(PathUriParseError::InvalidFileUriPath {
path: url.to_string(),
});
}
Ok(())
}
#[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.View on GitHub (pinned to 339751715c)