{"record":{"id":"ca8cfc847c3922ae","repo":"windmill-labs/windmill","slug":"invalid-inventory-resource-content-field-absent","errorCode":null,"errorMessage":"Invalid inventory resource, `content` field absent or invalid","messagePattern":"Invalid inventory resource, `content` field absent or invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/ansible_executor.rs","lineNumber":2273,"sourceCode":"                .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)\n                .map_err(|e| anyhow!(\"Inventory path (a.k.a. `name`) is invalid: {}\", e))?,\n        );\n\n        logs.push_str(&format!(\"\\nCreated inventory `{}`\", inventory.name));\n    }\n\n    for file_res in &r.file_resources {\n        let r =\n            get_resource_or_variable_content(client, &file_res.resource_path, job_id.to_string())\n                .await?;","sourceCodeStart":2255,"sourceCodeEnd":2291,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/ansible_executor.rs#L2255-L2291","documentation":"When the inventory comes from a resource object (content variable `content`), the executor requires a string field `content` holding the inventory text. If the object lacks `content` or it is not a string, this anyhow error is thrown. It means the resource shape does not match the expected inventory-resource schema.","triggerScenarios":"An inventory resource (or inline object) passed as the inventory arg is `{}` , has `content` as a non-string (object/number), or the wrong resource type was selected, in create_file_resources via handle_ansible_job.","commonSituations":"Pointing the script at a generic variable/duck resource instead of an inventory resource; hand-writing the resource JSON and forgetting `content`; a resource of type `inventory` whose stored value was edited and `content` removed; nested content object pasted instead of stringified JSON.","solutions":["Open the resource in the Windmill UI and ensure it is of type `inventory` with a string `content` field.","Recreate the resource via the inventory resource type so the schema is enforced.","If constructing inline, pass `{\"content\": \"<inventory JSON string>\"}` with content as a string.","Stringify the inventory document into `content` rather than nesting it as an object."],"exampleFix":"// before (wrong resource shape)\n{ \"web\": { \"hosts\": [\"host1\"] } }\n// after\n{ \"content\": \"{\\\"web\\\": {\\\"hosts\\\": [\\\"host1\\\"]}}\" }","handlingStrategy":"type-guard","validationCode":"const r = getResource('u/windmill/inventory', 'my_inv');\nif (typeof r?.content !== 'string') throw new Error('resource must have a string `content` field');","typeGuard":"function isInventoryResource(v) {\n  return v != null && typeof v === 'object' && typeof v.content === 'string' && v.content.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Create inventories through the dedicated inventory resource type so the schema is enforced.","Never hand-edit the resource JSON to drop `content`.","Stringify inventory documents into `content`; don't nest them.","Double-check which resource type is bound to the script's inventory arg."],"tags":["ansible","inventory","resource","schema"],"backgroundTag":"schema-validation-failed","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"}