openai/codex · error · std::io::Error

AWS auth refresh command must be `aws`

Error message

AWS auth refresh command must be `aws`

What it means

AwsAuthRecovery::refresh rejected the configured auth refresh command: only the literal `aws` executable is supported for refreshing Bedrock credentials, and AwsAuthRefreshConfig.command holds something else. The input at fault is the command field of the Bedrock provider's auth refresh config.

Solutions

  1. Set the Bedrock auth refresh command to `aws` in config
  2. Remove the custom command override so the default applies
  3. Ensure the AWS CLI is installed and authenticated, since it is the only supported refresher
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/model-provider/src/amazon_bedrock/auth_refresh.rs:30 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/e7ab5a786ec92735. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/model-provider/src/amazon_bedrock/auth_refresh.rs:30

#[derive(Debug)]
pub(crate) struct AwsAuthRecovery {
    config: AwsAuthRefreshConfig,
    refresh_lock: Semaphore,
    generation: AtomicU64,
}

impl AwsAuthRecovery {
    pub(crate) fn new(config: AwsAuthRefreshConfig) -> Self {
        Self {
            config,
            refresh_lock: Semaphore::new(/*permits*/ 1),
            generation: AtomicU64::new(0),
        }
    }

    pub(crate) async fn refresh(&self) -> std::io::Result<()> {
        if self.config.command != "aws" {
            return Err(std::io::Error::new(
                std::io::ErrorKind::InvalidInput,
                "AWS auth refresh command must be `aws`",
            ));
        }

        let generation = self.generation.load(Ordering::Acquire);
        let _refresh_lock = self
            .refresh_lock
            .acquire()
            .await
            .map_err(std::io::Error::other)?;
        if self.generation.load(Ordering::Acquire) != generation {
            return Ok(());
        }

        let mut command = Command::new(&self.config.command);
        command
            .args(self.config.args.iter().map(Deref::deref))

View on GitHub (pinned to 339751715c)