vectordotdev/vector · error

test name is required

Error message

test name is required

What it means

Same guard as the e2e variant, for `vdev integration show`: with --environments-only, the integration name is dereferenced via self.integration.expect("test name is required"). Omitting the integration argument while passing the flag panics instead of emitting a proper CLI usage error.

Solutions

  1. Supply the integration name: `cargo vdev integration show <integration> --environments-only`.
  2. Drop --environments-only and use the plain listing path (exec(self.integration.as_ref(), ...)) which handles a missing name.
  3. Consult `cargo vdev int show --help` for correct usage.
  4. In code, enforce via clap (required_unless_present / requires) or bail! with a clear message instead of expect.

Example fix

// before
exec_environments_only(
    &self.integration.expect("test name is required"),
    INTEGRATION_TESTS_DIR,
)
// after
exec_environments_only(
    self.integration.as_ref().ok_or_else(|| anyhow!("integration name is required with --environments-only"))?,
    INTEGRATION_TESTS_DIR,
)
Defensive patterns

Strategy: validation

Validate before calling

# shell wrapper before invoking vdev
if [ "$1" = "--environments-only" ] && [ -z "$2" ]; then
  echo "integration name is required with --environments-only" >&2; exit 2
fi

Type guard

fn require_integration_name(name: &Option<String>) -> Result<&String> {
    name.as_ref().ok_or_else(|| anyhow!("integration name is required with --environments-only"))
}

Prevention

When it happens

Trigger: Running `cargo vdev integration show --environments-only` (or `cargo vdev int show --environments-only`) with no integration name, leaving self.integration as None at the expect site.

Common situations: Omitting the positional argument in scripts or aliases; typo where the flag is given but the name is on the wrong side; assuming the flag lists all integrations' environments.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/d8c69040a8788516. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/integration/show.rs:24

use clap::Args;

/// Show information about integrations
#[derive(Args, Debug)]
#[command()]
pub struct Cli {
    /// The desired integration
    integration: Option<String>,

    /// Show only the available environments (newline separated)
    #[arg(short = 'e', long)]
    environments_only: bool,
}

impl Cli {
    pub fn exec(self) -> Result<()> {
        if self.environments_only {
            exec_environments_only(
                &self.integration.expect("test name is required"),
                INTEGRATION_TESTS_DIR,
            )
        } else {
            exec(self.integration.as_ref(), INTEGRATION_TESTS_DIR)
        }
    }
}

View on GitHub (pinned to bdb87aeaa4)