warpdotdev/warp · error

Field '{}' is required

Error message

Field '{}' is required

What it means

Inside build_managed_secret_value, after the count check, each zipped (field, value) pair is validated: any field with optional == false whose value trims to empty fails with this message naming the field's label.

Source

Thrown at app/src/ai/auth_secret_types.rs:57

const CODEX_LEARN_MORE_URL: &str =
    "https://docs.warp.dev/platform/harnesses/authentication/#connecting-codex-credentials";
const CLAUDE_LEARN_MORE_URL: &str =
    "https://docs.warp.dev/platform/harnesses/authentication/#connecting-claude-code-credentials";

pub fn build_managed_secret_value(
    info: &AuthSecretTypeInfo,
    field_values: &[String],
) -> Result<ManagedSecretValue> {
    if field_values.len() != info.fields.len() {
        return Err(anyhow!(
            "Expected {} field values, got {}",
            info.fields.len(),
            field_values.len()
        ));
    }
    for (field, value) in info.fields.iter().zip(field_values.iter()) {
        if !field.optional && value.trim().is_empty() {
            return Err(anyhow!("Field '{}' is required", field.label));
        }
    }
    match info.secret_type {
        ManagedSecretType::AnthropicApiKey => Ok(ManagedSecretValue::anthropic_api_key(
            field_values[0].clone(),
        )),
        ManagedSecretType::AnthropicBedrockApiKey => {
            Ok(ManagedSecretValue::anthropic_bedrock_api_key(
                field_values[0].clone(),
                field_values[1].clone(),
            ))
        }
        ManagedSecretType::AnthropicBedrockAccessKey => {
            let session_token = if field_values[2].trim().is_empty() {
                None
            } else {
                Some(field_values[2].clone())
            };

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Client-side: trim inputs and disable submit until every non-optional field is non-empty
  2. Show the exact field label from info.fields so the user knows which input to fix
  3. In automated callers, assert !value.trim().is_empty() for required fields before building

Example fix

// before
let value = build_managed_secret_value(&info, &field_values)?;

// after
let missing: Vec<&str> = info.fields.iter().zip(field_values.iter())
    .filter(|(f, v)| !f.optional && v.trim().is_empty())
    .map(|(f, _)| f.label)
    .collect();
if !missing.is_empty() {
    return Err(anyhow!("Missing required fields: {}", missing.join(", ")));
}
let value = build_managed_secret_value(&info, &field_values)?;
Defensive patterns

Strategy: validation

Validate before calling

let missing: Vec<&str> = info.fields.iter().zip(field_values.iter())
    .filter(|(f, v)| !f.optional && v.trim().is_empty())
    .map(|(f, _)| f.label)
    .collect();
assert!(missing.is_empty(), "required fields empty: {missing:?}");

Type guard

fn required_fields_satisfied(info: &AuthSecretTypeInfo, values: &[String]) -> bool {
    info.fields.iter().zip(values.iter())
        .all(|(f, v)| f.optional || !v.trim().is_empty())
}

Prevention

When it happens

Trigger: Submitting the harness FTUX credential form with a required field left blank or containing only whitespace (auth_secret_types.rs:56-59).

Common situations: User pastes spaces into the API key box; form trims but does not block submission; browser autofill leaves the field empty; automated caller passes placeholder empty strings for convenience.

Related errors


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