windmill-labs/windmill · error

The inventory argument was left empty. If you do not wish to

Error message

The inventory argument was left empty. If you do not wish to specify an inventory for this script, remove the `inventory:` section from the yaml.

What it means

After parsing, if the inventory argument deserializes to JSON null the executor refuses to proceed with this explicit guidance message. Windmill treats a null inventory as a configuration mistake: if you truly don't want an inventory, you must remove the `inventory:` section from the script yaml rather than pass null.

Source

Thrown at backend/windmill-worker/src/ansible_executor.rs:2263

            content = client
                .get_resource_value_interpolated::<serde_json::Value>(
                    resource_path,
                    Some(job_id.to_string()),
                )
                .await?;
        } else {
            let o = args
                .as_ref()
                .and_then(|g| g.get(&inventory.name))
                .ok_or(anyhow!(
                    "Specified inventory was missing in the script arguments"
                ))?;

            content = serde_json::from_str(o.get())
                .map_err(|e| anyhow!("Failed to parse inventory arg: {}", e))?;

            if content == serde_json::value::Value::Null {
                Err(anyhow!("The inventory argument was left empty. If you do not wish to specify an inventory for this script, remove the `inventory:` section from the yaml."))?;
            }
        }

        let validated_path = write_file_at_user_defined_location(
            job_dir,
            &inventory.name,
            content
                .get("content")
                .and_then(|v| v.as_str())
                .ok_or(anyhow!(
                    "Invalid inventory resource, `content` field absent or invalid"
                ))?,
            None,
        )
        .map_err(|e| anyhow!("Couldn't write inventory: {}", e))?;

        nsjail_mounts.push(
            define_nsjail_mount(job_dir, &validated_path)

View on GitHub (pinned to e474e8803c)

Solutions

  1. Remove the `inventory:` section from the script yaml if no inventory is needed.
  2. Or supply an actual inventory JSON object as the argument value.
  3. In flows, add a guard/default so a null upstream value is replaced or the step is skipped.
  4. In the run form, fill the inventory field or make the yaml not reference it.

Example fix

// before: yaml requires inventory, arg is null
args: { "inv": null }
// after: drop the section from the yaml
# inventory: { name: inv }  <-- removed
args: {}
Defensive patterns

Strategy: validation

Validate before calling

if (args.my_inventory === null || args.my_inventory === undefined) {
  throw new Error('inventory arg empty: remove the inventory: section from the yaml or supply a value');
}

Type guard

function isNonEmptyInventory(v) { return v != null; }

Prevention

When it happens

Trigger: Job args contain the inventory key with value null (e.g. the UI form field left empty, or a flow passed `$`-resolved null), while the script yaml still declares `inventory:` in create_file_resources.

Common situations: Leaving the inventory input blank in the run form; a flow's earlier step producing null and being passed through; JSON body with `"inv": null`; deleting a resource but leaving the arg binding.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/56d858875937fcde. Report an issue: GitHub.