nikivdev/code · error

lifecycle.domains.aliases[].host is required

Error message

lifecycle.domains.aliases[].host is required

What it means

ensure_domains_up validates the lifecycle.domains config before bringing domain routes up. Each entry in aliases must have a non-empty host; when it's missing or blank, this error is thrown. It's config validation failing fast rather than a runtime fault.

Source

Thrown at src/lifecycle.rs:136

        hub_port: 9050,
        name: task_name.to_string(),
        args,
    })
}

fn ensure_domains_up(cfg: &LifecycleDomainsConfig) -> Result<()> {
    let host = lifecycle_domain_host(cfg)?;
    let target = lifecycle_domain_target(cfg)?;
    let engine = parse_domains_engine(cfg.engine.as_deref())?;

    add_lifecycle_route(engine, host, target)?;
    for alias in &cfg.aliases {
        let alias_host = alias
            .host
            .as_deref()
            .map(str::trim)
            .filter(|v| !v.is_empty())
            .ok_or_else(|| anyhow!("lifecycle.domains.aliases[].host is required"))?;
        let alias_target = alias
            .target
            .as_deref()
            .map(str::trim)
            .filter(|v| !v.is_empty())
            .ok_or_else(|| anyhow!("lifecycle.domains.aliases[].target is required"))?;
        add_lifecycle_route(engine, alias_host, alias_target)?;
    }

    domains::run(DomainsCommand {
        engine,
        action: Some(DomainsAction::Up),
    })?;

    println!("Lifecycle domains ready: http://{}", host);

    Ok(())
}

View on GitHub (pinned to a747e741ae)

Solutions

  1. Add a non-empty host to every entry under lifecycle.domains.aliases
  2. Check key spelling (host, not hostname) and indentation in the config file
  3. Trim/quote values so they aren't parsed as blank
  4. Validate the whole config (host and target on every alias) before running up

Example fix

// before
domains:
  aliases:
    - target: "127.0.0.1:3000"
// after
domains:
  aliases:
    - host: "app.test"
      target: "127.0.0.1:3000"
Defensive patterns

Strategy: validation

Validate before calling

fn validate_aliases(cfg: &LifecycleDomainsConfig) -> Result<(), String> {
    for a in &cfg.aliases {
        match a.host.as_deref().map(str::trim).filter(|v| !v.is_empty()) {
            Some(_) => {}
            None => return Err("aliases[].host is required".into()),
        }
    }
    Ok(())
}

Prevention

When it happens

Trigger: Calling `run up` with a lifecycle.domains.aliases[] entry whose host field is absent, null, or whitespace-only.

Common situations: Hand-edited config files with a typo'd key (e.g. hostname instead of host), commented-out value left as empty string, YAML/TOML indentation mistakes dropping the field.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/b3fececcdab2a7d7. Report an issue: GitHub.