warpdotdev/warp · error · anyhow::Error

Secret name is required. Usage: oz secret create <NAME>

Error message

Secret name is required. Usage: oz secret create <NAME>

What it means

In create_secret, when no typed secret variant (e.g. an API-key subcommand) supplied a name, the generic path requires a positional NAME argument. args.name == None means create was invoked with only flags and no name, and the name cannot be inferred from anything else, so parsing aborts with a usage hint.

Source

Thrown at app/src/ai/agent_sdk/secret.rs:196

                },
                a.common.description,
                a.common.scope,
            ),
        },
        Some(CreateProvider::Codex(codex)) => match codex.method {
            CodexMethod::ApiKey(a) => (
                a.common.name,
                SecretInput::OpenaiApiKey {
                    value_args: a.value,
                    base_url: a.base_url,
                },
                a.common.description,
                a.common.scope,
            ),
        },
        None => {
            let name = args.name.ok_or_else(|| {
                anyhow::anyhow!("Secret name is required. Usage: oz secret create <NAME>")
            })?;
            (
                name,
                SecretInput::Simple {
                    secret_type: args.secret_type,
                    value_args: args.value,
                },
                args.description,
                args.scope,
            )
        }
    };

    create_secret_with_input(ctx, name, input, description, scope)
}

/// Shared creation logic: refreshes metadata, resolves the owner, reads the secret value, and
/// creates the secret.

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Add the positional name: oz secret create my-secret ...
  2. If you meant a typed secret (OpenAI/Anthropic key), use the typed subcommand whose flags include the name
  3. Quote shell variables so an empty var fails loudly instead of dropping the argument

Example fix

// before
oz secret create --value-file ./token
# Error: Secret name is required. Usage: oz secret create <NAME>

// after
oz secret create my-secret --value-file ./token
Defensive patterns

Strategy: validation

Validate before calling

let name = args.name.clone().or_else(|| typed_variant_name(&args))
    .ok_or_else(|| anyhow::anyhow!("pass the secret name: oz secret create <NAME>"))?;
create_secret(ctx, name, args).await?;

Prevention

When it happens

Trigger: oz secret create --value-file ./token (or with only --description/--scope flags) on the generic path, i.e. no typed subcommand that carries its own name.

Common situations: Assuming another flag identifies the secret; copy-pasting from docs that omitted the positional; shell quoting or an empty "$NAME" expansion swallowing the argument.

Related errors


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