nikivdev/code · error

lifecycle.domains.aliases[].target is required

Error message

lifecycle.domains.aliases[].target is required

What it means

ensure_domains_up validates each lifecycle.domains.aliases[] entry and requires a non-empty target (the address the host routes to). Blank or missing targets abort the up run with this error before any routes are applied.

Source

Thrown at src/lifecycle.rs:142

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(())
}

fn lifecycle_preferred_url(cfg: &LifecycleDomainsConfig) -> Option<String> {
    let host = lifecycle_domain_host(cfg).ok()?;
    Some(format!("http://{}", host))
}

View on GitHub (pinned to a747e741ae)

Solutions

  1. Set a non-empty target (e.g. host:port) for every alias entry
  2. Check that target is a sibling of host in the same aliases[] item
  3. Quote values with special characters (colons, IPv6) per your config format
  4. Run a full config validation before `up` to catch all bad aliases at once

Example fix

// before
- host: "api.test"
  target: ""
// after
- host: "api.test"
  target: "127.0.0.1:8080"
Defensive patterns

Strategy: validation

Validate before calling

fn validate_alias_targets(cfg: &LifecycleDomainsConfig) -> Result<(), String> {
    for a in &cfg.aliases {
        match a.target.as_deref().map(str::trim).filter(|v| !v.is_empty()) {
            Some(_) => {}
            None => return Err(format!("alias {:?} missing target", a.host)),
        }
    }
    Ok(())
}

Prevention

When it happens

Trigger: Calling `run up` with an aliases[] entry that has a host but a missing, null, or whitespace-only target field.

Common situations: Copy-pasted alias entries where target was left as a placeholder or empty string; config refactors that renamed the port field; YAML/TOML structure errors nesting target in the wrong place.

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/179de79eb7530678. Report an issue: GitHub.