{"record":{"id":"4a79d639c8ab69b8","repo":"warpdotdev/warp","slug":"secret-name-is-required-usage-oz-secret-create","errorCode":null,"errorMessage":"Secret name is required. Usage: oz secret create <NAME>","messagePattern":"Secret name is required\\. Usage: oz secret create <NAME>","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/secret.rs","lineNumber":196,"sourceCode":"                },\n                a.common.description,\n                a.common.scope,\n            ),\n        },\n        Some(CreateProvider::Codex(codex)) => match codex.method {\n            CodexMethod::ApiKey(a) => (\n                a.common.name,\n                SecretInput::OpenaiApiKey {\n                    value_args: a.value,\n                    base_url: a.base_url,\n                },\n                a.common.description,\n                a.common.scope,\n            ),\n        },\n        None => {\n            let name = args.name.ok_or_else(|| {\n                anyhow::anyhow!(\"Secret name is required. Usage: oz secret create <NAME>\")\n            })?;\n            (\n                name,\n                SecretInput::Simple {\n                    secret_type: args.secret_type,\n                    value_args: args.value,\n                },\n                args.description,\n                args.scope,\n            )\n        }\n    };\n\n    create_secret_with_input(ctx, name, input, description, scope)\n}\n\n/// Shared creation logic: refreshes metadata, resolves the owner, reads the secret value, and\n/// creates the secret.","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/secret.rs#L178-L214","documentation":"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.","triggerScenarios":"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.","commonSituations":"Assuming another flag identifies the secret; copy-pasting from docs that omitted the positional; shell quoting or an empty \"$NAME\" expansion swallowing the argument.","solutions":["Add the positional name: oz secret create my-secret ...","If you meant a typed secret (OpenAI/Anthropic key), use the typed subcommand whose flags include the name","Quote shell variables so an empty var fails loudly instead of dropping the argument"],"exampleFix":"// before\noz secret create --value-file ./token\n# Error: Secret name is required. Usage: oz secret create <NAME>\n\n// after\noz secret create my-secret --value-file ./token","handlingStrategy":"validation","validationCode":"let name = args.name.clone().or_else(|| typed_variant_name(&args))\n    .ok_or_else(|| anyhow::anyhow!(\"pass the secret name: oz secret create <NAME>\"))?;\ncreate_secret(ctx, name, args).await?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the positional NAME first in create commands","Quote shell variables so empty expansion fails visibly","Use typed subcommands when the name is implied by the type"],"tags":["agent-sdk","secrets","cli","usage","validation"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}