warpdotdev/warp · error

invalid value 'api-key'

Error message

invalid value 'api-key'

What it means

Thrown by the dispatcher arm for CliCommand::ApiKey (mod.rs:214) when `api-key` parsed but FeatureFlag::APIKeyManagement is disabled. The clap-mimicking 'invalid value' error hides API-key management subcommands when the flag is off. Flag defaults to false; availability is launch-channel/account dependent.

Source

Thrown at app/src/ai/agent_sdk/mod.rs:214

                return Err(anyhow::anyhow!("invalid value 'federate'"));
            }
            federate::run(ctx, global_options, federate_cmd)
        }
        CliCommand::HarnessSupport(args) => {
            if !FeatureFlag::AgentHarness.is_enabled() {
                return Err(anyhow::anyhow!("invalid value 'harness-support'"));
            }
            harness_support::run(ctx, global_options, args)
        }
        CliCommand::Artifact(artifact_cmd) => {
            if !FeatureFlag::ArtifactCommand.is_enabled() {
                return Err(anyhow::anyhow!("invalid value 'artifact'"));
            }
            artifact::run(ctx, global_options, artifact_cmd)
        }
        CliCommand::ApiKey(api_key_cmd) => {
            if !FeatureFlag::APIKeyManagement.is_enabled() {
                return Err(anyhow::anyhow!("invalid value 'api-key'"));
            }
            api_key::run(ctx, global_options, api_key_cmd)
        }
        CliCommand::Runner(runner_cmd) => {
            if !FeatureFlag::CloudAgentRunners.is_enabled() {
                return Err(anyhow::anyhow!("invalid value 'runner'"));
            }
            runner::run(ctx, global_options, runner_cmd)
        }
    }
}

fn format_skill_resolution_error(err: ResolveSkillError) -> String {
    match err {
        ResolveSkillError::NotFound { skill } => {
            format!("Skill '{skill}' not found")
        }
        ResolveSkillError::RepoNotFound { repo } => {

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Use a build/account where APIKeyManagement is enabled, or update the CLI
  2. Create keys through the web UI if available, and use those in automation
  3. As a Warp developer, override the flag or add FeatureFlag::APIKeyManagement to DOGFOOD_FLAGS and rebuild

Example fix

# before
$ oz api-key create --name ci
Error: invalid value 'api-key'

# after
if FeatureFlag::APIKeyManagement.is_enabled() {
    api_key::run(ctx, global_options, cmd)?;
}
Defensive patterns

Strategy: validation

Validate before calling

if matches!(cmd, CliCommand::ApiKey(_))
    && !FeatureFlag::APIKeyManagement.is_enabled()
{
    anyhow::bail!("API key management is gated in this build");
}

Type guard

pub fn api_key_cmd_available() -> bool {
    FeatureFlag::APIKeyManagement.is_enabled()
}

Try / catch

match agent_sdk::run(ctx, opts, cmd) {
    Err(e) if e.to_string() == "invalid value 'api-key'" => {
        // create keys via web UI; do not retry here
    }
    result => result?,
}

Prevention

When it happens

Trigger: Invoking `<cli> api-key <subcmd>` (create/revoke API keys) where FeatureFlag::APIKeyManagement.is_enabled() == false.

Common situations: Automation trying to mint API keys for CI authentication on a build where key management is gated; users following API docs on older CLI versions; accounts not enrolled in the API-key rollout.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/1074ad1fa2d80cd8. Report an issue: GitHub.