openai/codex · error · PathUriParseError
ports are not allowed in path URIs
Error message
ports are not allowed in path URIs
What it means
The PortNotAllowed variant of PathUriParseError: the URI includes an explicit port (e.g. file://host:8042/path). Path URIs have no network endpoint semantics, so validate_common_known_uri rejects any port component.
Solutions
- Remove the port component from the URI
- Regenerate the URI from an absolute filesystem path
- Route the value through a URL type if a port is actually meaningful
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/utils/path-uri/src/lib.rs:890 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/ef4b8237ff5ad373.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/utils/path-uri/src/lib.rs:890
{
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.
///
/// 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,View on GitHub (pinned to 339751715c)