openai/codex · error · io::Error

Config file {} has no parent directory

Error message

Config file {} has no parent directory

What it means

Error "Config file {} has no parent directory" thrown in openai/codex.

Source

Thrown at codex-rs/config/src/loader/mod.rs:587

    let loaded = load_config_toml_for_required_layer_raw(fs, toml_file, strict_config).await?;
    let toml_value = resolve_relative_paths_in_config_toml(loaded.toml, loaded.base_dir.as_path())?;

    Ok(create_entry(toml_value))
}

#[derive(Debug, Clone)]
struct LoadedTomlFile {
    toml: TomlValue,
    base_dir: AbsolutePathBuf,
}

async fn load_config_toml_for_required_layer_raw(
    fs: &dyn ExecutorFileSystem,
    toml_file: &AbsolutePathBuf,
    strict_config: bool,
) -> io::Result<LoadedTomlFile> {
    let config_parent = toml_file.as_path().parent().ok_or_else(|| {
        io::Error::new(
            io::ErrorKind::InvalidData,
            format!(
                "Config file {} has no parent directory",
                toml_file.as_path().display()
            ),
        )
    })?;
    let base_dir = AbsolutePathBuf::from_absolute_path(config_parent)?;
    let toml_file_uri = PathUri::from_abs_path(toml_file);
    let toml_value = match fs
        .read_file_text(&toml_file_uri, Default::default(), /*sandbox*/ None)
        .await
    {
        Ok(contents) => {
            let config: TomlValue = toml::from_str(&contents).map_err(|err| {
                let config_error =
                    config_error_from_toml(toml_file.as_path(), &contents, err.clone());
                io_error_from_config_error(io::ErrorKind::InvalidData, config_error, Some(err))

View on GitHub (pinned to 339751715c)

Solutions

  1. Ensure the config file path has a valid parent directory.

When it happens

Trigger: Thrown at codex-rs/config/src/loader/mod.rs:587 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/1d44106e39e2128d. Report an issue: GitHub.