jdx/mise · error

bootstrap compose project

Error message

bootstrap compose project '{name}' services cannot be combined with state = "absent" because compose down removes the entire project

What it means

A declaration with state = "absent" removes the entire compose project (compose down), so per-service targeting is meaningless and dangerous. from_toml_with_origin rejects any absent-state declaration that also lists services, forcing users to express removal at project level.

Solutions

  1. Remove the services list from the absent-state declaration
  2. If you only want some services gone, set state = "present" with the remaining services subset, or scale/remove services via the compose file itself
  3. Use separate declarations: one present declaration for kept services, and plan full removal only when tearing down the whole project

Example fix

# before
[bootstrap.compose.app]
state = "absent"
services = ["web", "worker"]

# after
[bootstrap.compose.app]
state = "absent"
Defensive patterns

Strategy: validation

Validate before calling

def validate_absent_no_services(config: dict) -> None:
    for name, decl in config.get("bootstrap", {}).get("compose", {}).items():
        if decl.get("state") == "absent" and decl.get("services"):
            raise ValueError(f"{name}: services cannot be combined with state=absent")

Prevention

When it happens

Trigger: Config sets state = "absent" together with a non-empty services array under [bootstrap.compose.<name>]; a user edits a previously 'present' per-service declaration to state = "absent" to tear down one service.

Common situations: Trying to remove a single service by flipping state to absent; leftover services list in a teardown section; copy-paste of a present-state block with only state changed.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/751069b6958e9943. Report an issue: GitHub.

Appendix: source

Thrown at src/system/compose.rs:330

        origin: Option<ResourceOrigin>,
    ) -> Result<Self> {
        if name.is_empty() {
            bail!("bootstrap compose project names cannot be empty");
        }
        if !config.project_dir.is_absolute() {
            bail!(
                "bootstrap compose project '{name}' project_dir must be absolute: {}",
                config.project_dir.display()
            );
        }
        validate_project_name(config.project_name.as_deref())?;
        validate_values("profile", &config.profiles)?;
        validate_values("service", &config.services)?;
        validate_values("oneshot service", &config.oneshot)?;
        validate_command("command", &config.command)?;
        validate_command("engine_command", &config.engine_command)?;
        if config.state == ComposeState::Absent && !config.services.is_empty() {
            bail!(
                "bootstrap compose project '{name}' services cannot be combined with state = \"absent\" because compose down removes the entire project"
            );
        }
        if !config.wait && config.wait_timeout.is_some() {
            bail!("bootstrap compose project '{name}' wait_timeout requires wait = true");
        }
        if config.wait_timeout == Some(0) {
            bail!("bootstrap compose project '{name}' wait_timeout must be greater than zero");
        }
        if config.state != ComposeState::Absent
            && (config.down_volumes || config.down_images.is_some())
        {
            bail!(
                "bootstrap compose project '{name}' down_volumes and down_images require state = \"absent\""
            );
        }
        if config.state != ComposeState::Running && config.renew_anonymous_volumes {
            bail!(

View on GitHub (pinned to 533346cc37)