{"record":{"id":"487a8cfd41741487","repo":"vectordotdev/vector","slug":"integration-has-no-environments","errorCode":null,"errorMessage":"Integration has no environments","messagePattern":"Integration has no environments","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/compose_tests/start.rs","lineNumber":19,"sourceCode":"use anyhow::Result;\n\nuse crate::testing::{\n    config::ComposeTestConfig,\n    integration::{ComposeTest, ComposeTestLocalConfig},\n};\n\npub(crate) fn exec(\n    local_config: ComposeTestLocalConfig,\n    integration: &str,\n    environment: Option<&String>,\n) -> Result<()> {\n    let environment = if let Some(environment) = environment {\n        environment.clone()\n    } else {\n        let (_test_dir, config) = ComposeTestConfig::load(local_config.directory, integration)?;\n        let envs = config.environments();\n        trace!(\"Available environments: {envs:#?}\");\n        let env = envs.keys().next().expect(\"Integration has no environments\");\n        env.clone()\n    };\n    debug!(\"Selected environment: {environment:#?}\");\n    ComposeTest::generate(local_config, integration, environment, 0, false)?.start()\n}\n","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/compose_tests/start.rs#L1-L25","documentation":"When starting a compose integration test without an explicit environment, vdev loads the integration's ComposeTestConfig and picks envs.keys().next().expect(\"Integration has no environments\"). The expect panics when the integration defines zero environments, meaning the integration directory lacks a valid docker-compose configuration that exposes any environment. This is a data/config problem in the integration itself, surfaced as a panic.","triggerScenarios":"Running `cargo vdev compose-tests start <integration>` (or the equivalent without --environment) where the integration's config has an empty environments map — e.g. missing docker-compose file, wrong directory, or an integration that only defines environments conditionally.","commonSituations":"A newly added integration test dir without compose config; a typo in the integration name resolving to the wrong directory; compose file format change causing environments() to parse nothing.","solutions":["Pass an environment explicitly: `cargo vdev compose-tests start <integration> --environment <env>` once you know a valid one.","Inspect the integration directory (tests/<integration>/) for its compose/config files and ensure at least one environment is defined.","Verify the integration name matches a directory under the integration tests root; fix typos.","In code, replace expect with a friendly error: envs.into_keys().next().ok_or_else(|| anyhow!(\"integration '{integration}' has no environments\"))?.","Regenerate/refresh the compose test config if the underlying docker-compose files were restructured."],"exampleFix":"// before\nlet env = envs.keys().next().expect(\"Integration has no environments\");\n// after\nlet env = envs.keys().next().ok_or_else(||\n    anyhow!(\"integration '{}' defines no environments\", integration)\n)?;","handlingStrategy":"validation","validationCode":"# before invoking start\ncfg = load_compose_test_config(integration)\nif not cfg.environments:\n    raise SystemExit(f\"integration '{integration}' has no environments\")","typeGuard":"fn has_environments(envs: &HashMap<String, Environment>) -> bool { !envs.is_empty() }","tryCatchPattern":"match envs.keys().next() {\n    Some(env) => /* use env */,\n    None => return Err(anyhow!(\"integration '{}' defines no environments\", integration)),\n}","preventionTips":["Ensure every integration test directory defines at least one compose environment.","Pass --environment explicitly in scripts to skip auto-selection.","Verify integration names against the tests directory before running.","Regenerate compose test configs after restructuring docker-compose files."],"tags":["rust","vdev","integration-tests","docker-compose","configuration","panic"],"backgroundTag":"empty-result-set","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"}