warpdotdev/warp · error · anyhow::Error
expiration behavior is required
Error message
expiration behavior is required
What it means
`expires_at_from_args` requires exactly one expiration behavior: `--no-expiration`, `--expires-at`, or `--expires-in`. If none is provided, the function falls through to this error — the server needs an explicit expiration decision and the CLI applies no default.
Source
Thrown at app/src/ai/agent_sdk/api_key.rs:425
}
}
fn expires_at_from_args(args: ApiKeyExpirationArgs) -> Result<Option<Time>> {
if args.no_expiration {
return Ok(None);
}
if let Some(expires_at) = args.expires_at {
return Ok(Some(Time::from(expires_at)));
}
if let Some(expires_in) = args.expires_in {
let duration = chrono::Duration::from_std(expires_in.into())
.map_err(|_| anyhow!("expiration duration is too large"))?;
return Ok(Some(Time::from(Utc::now() + duration)));
}
Err(anyhow!("expiration behavior is required"))
}
fn print_created_api_key(
result: CreatedApiKeyInfo,
output_format: OutputFormat,
json_output: warp_cli::json_filter::JsonOutput,
) -> Result<()> {
if json_output.force_json_output() {
output::print_raw_json(serde_json::to_value(&result)?, &json_output)?;
return Ok(());
}
match output_format {
OutputFormat::Json => output::write_json(&result, std::io::stdout())?,
OutputFormat::Ndjson => output::write_json_line(&result, std::io::stdout())?,
OutputFormat::Pretty | OutputFormat::Text => {
println!("API key '{}' created.", result.api_key.name);
println!("UID: {}", result.api_key.uid);
println!("Raw API key: {}", result.raw_api_key);View on GitHub (pinned to e72fd7aacb)
Solutions
- Add `--no-expiration` if the key should not expire
- Add `--expires-at <timestamp>` or `--expires-in <duration>` for bounded keys
- Update wrapper scripts and templates to always set exactly one expiration flag
Example fix
# before warp api-key create ci # after warp api-key create ci --expires-in 720h
Defensive patterns
Strategy: validation
Validate before calling
fn expiration_specified(a: &ApiKeyExpirationArgs) -> bool {
a.no_expiration || a.expires_at.is_some() || a.expires_in.is_some()
}
// Require this to be true before invoking the create command. Prevention
- Make one expiration flag mandatory in wrapper scripts
- Fail fast in tooling when none is set, with a clearer message
When it happens
Trigger: Running `warp api-key create <name>` with none of --no-expiration / --expires-at / --expires-in supplied, so the argument struct has all three unset.
Common situations: Wrappers that only forward name and scope flags; docs or templates written for an older CLI that defaulted to no expiration; interactive walkthroughs missing the new required flag.
Related errors
- expiration duration is too large
- Invalid repo format: '{}'. Expected 'owner/repo' or 'https:/
- No updates requested
- unexpected argument '--skill' found
- Either --prompt, --skill, or --conversation must be provided
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/8411aa0d39d8c08a.
Report an issue: GitHub.