zeroclaw-labs/zeroclaw · error

cloud_ops.default_cloud must not be empty when cloud_ops is

Error message

cloud_ops.default_cloud must not be empty when cloud_ops is enabled

What it means

`CloudOpsConfig` is only validated when `enabled = true`; in that state it must name a `default_cloud` that is non-empty after trimming. The field defaults to `"aws"`, so this error means the operator explicitly set it to an empty or whitespace-only string while enabling the feature.

Source

Thrown at crates/zeroclaw-config/src/schema.rs:18568

impl Default for CloudOpsConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            default_cloud: default_cloud_ops_cloud(),
            supported_clouds: default_cloud_ops_supported_clouds(),
            iac_tools: default_cloud_ops_iac_tools(),
            cost_threshold_monthly_usd: default_cloud_ops_cost_threshold(),
            well_architected_frameworks: default_cloud_ops_waf(),
        }
    }
}

impl CloudOpsConfig {
    pub fn validate(&self) -> Result<()> {
        if self.enabled {
            if self.default_cloud.trim().is_empty() {
                anyhow::bail!(
                    "cloud_ops.default_cloud must not be empty when cloud_ops is enabled"
                );
            }
            if self.supported_clouds.is_empty() {
                anyhow::bail!(
                    "cloud_ops.supported_clouds must not be empty when cloud_ops is enabled"
                );
            }
            for (i, cloud) in self.supported_clouds.iter().enumerate() {
                if cloud.trim().is_empty() {
                    validation_bail!(
                        RequiredFieldEmpty,
                        format!("cloud_ops.supported_clouds[{i}]"),
                        "cloud_ops.supported_clouds[{i}] must not be empty"
                    );
                }
            }
            if !self.supported_clouds.contains(&self.default_cloud) {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Set a concrete value present in your cloud tooling, e.g. `default_cloud = "aws"`.
  2. Remove the `default_cloud` key entirely to fall back to the built-in `aws` default.
  3. If using templating, assert the variable is non-empty at render time.

Example fix

# before
[cloud_ops]
enabled = true
default_cloud = ""

# after
[cloud_ops]
enabled = true
default_cloud = "aws"
Defensive patterns

Strategy: validation

Validate before calling

anyhow::ensure!(
    !cloud_ops.enabled || !cloud_ops.default_cloud.trim().is_empty(),
    "cloud_ops.default_cloud required when enabled"
);

Prevention

When it happens

Trigger: `[cloud_ops] enabled = true` with `default_cloud = ""` or `default_cloud = " "`; a template variable that renders empty (e.g. `default_cloud = "${CLOUD}"` with the env var unset in TOML rendering); clearing the field while testing and leaving `enabled` on.

Common situations: Templated/Kustomize-style configs where the cloud value comes from a variable; partial edits that disable a cloud migration midway; assuming the `aws` default survives an explicit empty override (it does not — explicit empty wins).

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/3e245fc53c900754. Report an issue: GitHub.