{"record":{"id":"ec229fe2768548ab","repo":"vectordotdev/vector","slug":"test-name-is-required","errorCode":null,"errorMessage":"test name is required","messagePattern":"test name is required","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/e2e/show.rs","lineNumber":23,"sourceCode":"use anyhow::Result;\nuse clap::Args;\n\n/// Show information about e2e-tests\n#[derive(Args, Debug)]\n#[command()]\npub struct Cli {\n    /// The desired e2e test name\n    test: Option<String>,\n\n    /// Show only the available environments (newline separated)\n    #[arg(short = 'e', long)]\n    environments_only: bool,\n}\n\nimpl Cli {\n    pub fn exec(self) -> Result<()> {\n        if self.environments_only {\n            exec_environments_only(&self.test.expect(\"test name is required\"), E2E_TESTS_DIR)\n        } else {\n            exec(self.test.as_ref(), E2E_TESTS_DIR)\n        }\n    }\n}\n","sourceCodeStart":5,"sourceCodeEnd":29,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/e2e/show.rs#L5-L29","documentation":"vdev's `e2e show` command requires a test name when --environments-only is used: it calls self.test.expect(\"test name is required\"). If the user runs the command with the environments-only flag but omits the test argument, the Option is None and the CLI panics with this message instead of printing a usage error. It is a missing-required-CLI-argument guard implemented as an expect.","triggerScenarios":"Running `cargo vdev e2e show --environments-only` without providing a test name, so self.test is None when exec_environments_only dereferences it.","commonSituations":"Forgetting the test positional after the flag; scripting the command and dropping an argument; assuming --environments-only lists all tests without needing a name.","solutions":["Provide the test name: `cargo vdev e2e show <test> --environments-only`.","Run without --environments-only if you want the general listing handled by exec(self.test.as_ref(), ...), which tolerates a missing name.","Check `cargo vdev e2e show --help` for the expected argument order.","In code, validate in clap (make the arg required_with = \"environments_only\") or return anyhow::bail!(\"test name is required with --environments-only\") instead of expect."],"exampleFix":"// before\nexec_environments_only(&self.test.expect(\"test name is required\"), E2E_TESTS_DIR)\n// after\nexec_environments_only(\n    self.test.as_ref().ok_or_else(|| anyhow!(\"test name is required with --environments-only\"))?,\n    E2E_TESTS_DIR,\n)","handlingStrategy":"validation","validationCode":"# shell wrapper before invoking vdev\nif [ \"$1\" = \"--environments-only\" ] && [ -z \"$2\" ]; then\n  echo \"test name is required with --environments-only\" >&2; exit 2\nfi","typeGuard":"fn require_test_name(test: &Option<String>) -> Result<&String> {\n    test.as_ref().ok_or_else(|| anyhow!(\"test name is required with --environments-only\"))\n}","tryCatchPattern":null,"preventionTips":["Always pass the test name with --environments-only: `vdev e2e show <test> --environments-only`.","Use --help to confirm argument order before scripting.","Enforce the requirement in clap via `requires = \"test\"` on the flag.","Wrap vdev calls in scripts that validate arguments first."],"tags":["rust","vdev","cli","missing-argument","e2e-tests","panic"],"backgroundTag":"missing-cli-argument","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}