windmill-labs/windmill · error
Error getting ansible collection versions: {stderr}
Error message
Error getting ansible collection versions: {stderr} What it means
Windmill's ansible dependency-locking step runs `ansible-galaxy collection list` and requires it to exit successfully. When the process returns a non-zero status, the worker aborts and surfaces the process stderr verbatim so the underlying ansible failure is visible. It is thrown from get_collection_locks while computing dependency locks for an ansible job.
Source
Thrown at backend/windmill-worker/src/ansible_executor.rs:1084
}
pub async fn get_collection_locks(
job_dir: &str,
) -> anyhow::Result<(HashMap<String, String>, String)> {
let mut ansible_cmd = Command::new(ANSIBLE_GALAXY_PATH.as_str());
ansible_cmd
.current_dir(job_dir)
.args(["collection", "list", "--format", "json", "-p", "./"]);
let output = ansible_cmd.output().await?;
let mut ret = HashMap::new();
let mut logs = String::new();
if !output.status.success() {
let stderr = String::from_utf8(output.stderr)?;
return Err(anyhow!(
"Error getting ansible collection versions: {stderr}"
));
}
let stdout = String::from_utf8(output.stdout)?;
let val: serde_json::Value = serde_json::from_str(&stdout)?;
let Some(own_collections) = val.get(format!("{}/ansible_collections", job_dir)) else {
return Ok((ret, logs));
};
let collections = own_collections.as_object().ok_or(anyhow!(
"Expected an object (map) for the `ansible-galaxy collection list` command output and got {}",
own_collections
))?;
for (c_name, c) in collections.iter() {View on GitHub (pinned to e474e8803c)
Solutions
- Read the stderr embedded in the message and fix the underlying ansible-galaxy failure it reports.
- Verify ansible/ansible-core is installed in the worker image (`ansible-galaxy --version`) and on PATH.
- Delete/clean the job's collection directory and re-run the collection install step.
- Check for a malformed ansible.cfg in the workspace/job directory.
- Pin a compatible ansible-core version if a recent upgrade changed CLI behavior.
Example fix
// Dockerfile of worker image // before RUN pip install ansible-runner // after RUN pip install ansible-core ansible-runner && ansible-galaxy --version
Defensive patterns
Strategy: validation
Validate before calling
// before running the job, on the worker: ansible-galaxy --version || echo 'ansible-galaxy missing or broken' ansible-galaxy collection list >/dev/null 2>&1 && echo OK || echo 'collection list fails; fix ansible install'
Prevention
- Bake ansible-core into the worker image and smoke-test ansible-galaxy at build time
- Keep ansible-core version pinned and compatible with the Windmill worker
- Clean corrupted collection directories instead of retrying blindly
- Check ansible.cfg validity in workspace repos
When it happens
Trigger: Running an ansible script/job whose dependency-lock phase invokes `ansible-galaxy collection list` in the job directory and the command exits non-zero (bad install, broken ansible install, unreadable collections dir, invalid ansible.cfg).
Common situations: ansible/ansible-galaxy not installed or not on PATH in the worker image; a partially-failed `ansible-galaxy collection install` left a corrupt collections directory; an invalid ansible.cfg in the job dir; incompatible ansible-core version whose CLI flags changed.
Related errors
- Error getting git repo commit hash: {stderr}
- Script '${path}' has a deployment error and cannot be run:\n
- failed to execute replace_ephemeral command: {}
- Failed to parse yaml: {}
- Invalid inventory definition
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/e5f99c63eaf7e98d.
Report an issue: GitHub.