{"record":{"id":"56d858875937fcde","repo":"windmill-labs/windmill","slug":"the-inventory-argument-was-left-empty-if-you-do-n","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/ansible_executor.rs","lineNumber":2263,"sourceCode":"            content = client\n                .get_resource_value_interpolated::<serde_json::Value>(\n                    resource_path,\n                    Some(job_id.to_string()),\n                )\n                .await?;\n        } else {\n            let o = args\n                .as_ref()\n                .and_then(|g| g.get(&inventory.name))\n                .ok_or(anyhow!(\n                    \"Specified inventory was missing in the script arguments\"\n                ))?;\n\n            content = serde_json::from_str(o.get())\n                .map_err(|e| anyhow!(\"Failed to parse inventory arg: {}\", e))?;\n\n            if content == serde_json::value::Value::Null {\n                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.\"))?;\n            }\n        }\n\n        let validated_path = write_file_at_user_defined_location(\n            job_dir,\n            &inventory.name,\n            content\n                .get(\"content\")\n                .and_then(|v| v.as_str())\n                .ok_or(anyhow!(\n                    \"Invalid inventory resource, `content` field absent or invalid\"\n                ))?,\n            None,\n        )\n        .map_err(|e| anyhow!(\"Couldn't write inventory: {}\", e))?;\n\n        nsjail_mounts.push(\n            define_nsjail_mount(job_dir, &validated_path)","sourceCodeStart":2245,"sourceCodeEnd":2281,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/ansible_executor.rs#L2245-L2281","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the `inventory:` section from the script yaml if no inventory is needed.","Or supply an actual inventory JSON object as the argument value.","In flows, add a guard/default so a null upstream value is replaced or the step is skipped.","In the run form, fill the inventory field or make the yaml not reference it."],"exampleFix":"// before: yaml requires inventory, arg is null\nargs: { \"inv\": null }\n// after: drop the section from the yaml\n# inventory: { name: inv }  <-- removed\nargs: {}","handlingStrategy":"validation","validationCode":"if (args.my_inventory === null || args.my_inventory === undefined) {\n  throw new Error('inventory arg empty: remove the inventory: section from the yaml or supply a value');\n}","typeGuard":"function isNonEmptyInventory(v) { return v != null; }","tryCatchPattern":null,"preventionTips":["Remove the `inventory:` section from the yaml when no inventory is needed.","Give the inventory arg a default in the script schema so it can't be null.","Guard flow paths that can produce null upstream values.","Don't leave inventory form fields blank when the yaml requires one."],"tags":["ansible","inventory","null-value","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}