vectordotdev/vector · error

Integration has no environments

Error message

Integration has no environments

What it means

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.

Solutions

  1. Pass an environment explicitly: `cargo vdev compose-tests start <integration> --environment <env>` once you know a valid one.
  2. Inspect the integration directory (tests/<integration>/) for its compose/config files and ensure at least one environment is defined.
  3. Verify the integration name matches a directory under the integration tests root; fix typos.
  4. In code, replace expect with a friendly error: envs.into_keys().next().ok_or_else(|| anyhow!("integration '{integration}' has no environments"))?.
  5. Regenerate/refresh the compose test config if the underlying docker-compose files were restructured.

Example fix

// before
let env = envs.keys().next().expect("Integration has no environments");
// after
let env = envs.keys().next().ok_or_else(||
    anyhow!("integration '{}' defines no environments", integration)
)?;
Defensive patterns

Strategy: validation

Validate before calling

# before invoking start
cfg = load_compose_test_config(integration)
if not cfg.environments:
    raise SystemExit(f"integration '{integration}' has no environments")

Type guard

fn has_environments(envs: &HashMap<String, Environment>) -> bool { !envs.is_empty() }

Try / catch

match envs.keys().next() {
    Some(env) => /* use env */,
    None => return Err(anyhow!("integration '{}' defines no environments", integration)),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at vdev/src/commands/compose_tests/start.rs:19

use anyhow::Result;

use crate::testing::{
    config::ComposeTestConfig,
    integration::{ComposeTest, ComposeTestLocalConfig},
};

pub(crate) fn exec(
    local_config: ComposeTestLocalConfig,
    integration: &str,
    environment: Option<&String>,
) -> Result<()> {
    let environment = if let Some(environment) = environment {
        environment.clone()
    } else {
        let (_test_dir, config) = ComposeTestConfig::load(local_config.directory, integration)?;
        let envs = config.environments();
        trace!("Available environments: {envs:#?}");
        let env = envs.keys().next().expect("Integration has no environments");
        env.clone()
    };
    debug!("Selected environment: {environment:#?}");
    ComposeTest::generate(local_config, integration, environment, 0, false)?.start()
}

View on GitHub (pinned to bdb87aeaa4)