openai/codex · error · anyhow::Error

Unknown feature flag

Error message

Unknown feature flag: {feature}

What it means

FeatureToggles::validate_feature rejection: --enable/--disable was given a feature key not present in the known feature registry (is_known_feature_key returned false), so it cannot become a features.<key> config override.

Solutions

  1. Check the spelling of the feature name
  2. Consult the Codex docs for valid feature keys in your version
  3. Upgrade Codex if the feature was added in a newer release
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/cli/src/main.rs:1003 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/a78076b0ff213eb0. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/cli/src/main.rs:1003

impl FeatureToggles {
    fn to_overrides(&self) -> anyhow::Result<Vec<String>> {
        let mut v = Vec::new();
        for feature in &self.enable {
            Self::validate_feature(feature)?;
            v.push(format!("features.{feature}=true"));
        }
        for feature in &self.disable {
            Self::validate_feature(feature)?;
            v.push(format!("features.{feature}=false"));
        }
        Ok(v)
    }

    fn validate_feature(feature: &str) -> anyhow::Result<()> {
        if is_known_feature_key(feature) {
            Ok(())
        } else {
            anyhow::bail!("Unknown feature flag: {feature}")
        }
    }
}

#[derive(Debug, Parser)]
struct FeaturesCli {
    #[command(subcommand)]
    sub: FeaturesSubcommand,
}

#[derive(Debug, Parser)]
enum FeaturesSubcommand {
    /// List known features with their stage and effective state.
    List,
    /// Enable a feature in config.toml.
    Enable(FeatureSetArgs),
    /// Disable a feature in config.toml.
    Disable(FeatureSetArgs),

View on GitHub (pinned to 339751715c)