{"record":{"id":"423872b383061028","repo":"vectordotdev/vector","slug":"requested-environment-environment-does-not-match-active-one","errorCode":null,"errorMessage":"Requested environment {environment:?} does not match active one {active:?}","messagePattern":"Requested environment (.+?) does not match active one (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/compose_tests/test.rs","lineNumber":30,"sourceCode":"\npub fn exec(\n    local_config: ComposeTestLocalConfig,\n    integration: &str,\n    environment: Option<&String>,\n    retries: u8,\n    args: &[String],\n    coverage: bool,\n) -> Result<()> {\n    let (_test_dir, config) = ComposeTestConfig::load(local_config.directory, integration)?;\n    let envs = config.environments();\n\n    let active =\n        find_active_environment_for_integration(local_config.directory, integration, &config)?;\n    debug!(\"Active environment: {active:#?}\");\n\n    let environments: Box<dyn Iterator<Item = &String>> = match (environment, &active) {\n        (Some(environment), Some(active)) if environment != active => {\n            bail!(\"Requested environment {environment:?} does not match active one {active:?}\")\n        }\n        (Some(environment), _) => Box::new(once(environment)),\n        (None, Some(active)) => Box::new(once(active)),\n        (None, None) => Box::new(envs.keys()),\n    };\n\n    if coverage {\n        clear_coverage();\n    }\n\n    let mut ran_environments = Vec::new();\n    for environment in environments {\n        run_environment(\n            local_config,\n            integration,\n            environment,\n            retries,\n            args,","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/compose_tests/test.rs#L12-L48","documentation":"Thrown by `cargo vdev compose_tests test` (exec) when the caller requests a specific integration environment that does not match the currently active environment for that integration (found via find_active_environment_for_integration). Only one environment may be active per integration at a time, so a mismatched request is rejected.","triggerScenarios":"Calling the test command with `--environment <name>` (or Some(environment)) while a different environment is active for the integration directory, i.e. environment != active in the match.","commonSituations":"Happens when switching between cloud integration setups (e.g. AWS vs GCP) without deactivating the previous environment, or when CI/dev machines have a stale active environment configured.","solutions":["Run without the --environment flag so the active environment is used automatically.","Deactivate the current environment for the integration, then activate the requested one and re-run.","Run `cargo vdev int show` to inspect which environment is active.","Pass the exact active environment name (match the debug output 'Active environment')."],"exampleFix":"// before\ncargo vdev compose_tests test gcp-cloud-storage --environment aws-integration-tests\n// after\ncargo vdev int deactivate\ncargo vdev int activate gcp\ncargo vdev compose_tests test gcp-cloud-storage","handlingStrategy":"validation","validationCode":"if let Some(req) = requested_environment { assert_eq!(req, active_environment.expect(\"no active environment\"), \"requested environment must match active one\"); }","typeGuard":"fn env_matches(requested: &str, active: Option<&String>) -> bool { matches!(active, Some(a) if a == requested) || active.is_none() }","tryCatchPattern":"match result { Err(e) if e.to_string().starts_with(\"Requested environment\") => { eprintln!(\"Deactivate current env or drop --environment flag\"); } Err(e) => return Err(e), Ok(v) => v }","preventionTips":["Omit the --environment flag unless you know the active environment","Run `cargo vdev int show` to inspect the active environment before testing","Deactivate old environments when switching clouds"],"tags":["cli","testing","environment"],"backgroundTag":"invalid-argument-value","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"}