openai/codex · error · io::Error

Failed to read config file

Error message

Failed to read config file {}: {e}

What it means

Reading a required config.toml layer failed with an I/O error other than NotFound (e.g. permission denied or an OS-level read failure); the underlying error {e} is wrapped with the file path for context. Config loading aborts because required layers must be readable.

Solutions

  1. Check that the config file exists and is readable (permissions, path).
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

                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))
            })?;
            if strict_config {
                validate_config_toml_strictly(
                    toml_file.as_path(),
                    &contents,
                    &config,
                    config_parent,
                )?;
            }
            Ok(config)
        }
        Err(e) => {
            if e.kind() == io::ErrorKind::NotFound {
                Ok(TomlValue::Table(toml::map::Map::new()))
            } else {
                Err(io::Error::new(
                    e.kind(),
                    format!(
                        "Failed to read config file {}: {e}",
                        toml_file.as_path().display()
                    ),
                ))
            }
        }
    }?;

    Ok(LoadedTomlFile {
        toml: toml_value,
        base_dir,
    })
}

fn validate_config_toml_strictly(
    toml_file: &Path,

View on GitHub (pinned to 339751715c)