#16682·awx

Sliced job template launched with a limit fails every slice that has no matching hosts

Author: quanahCreated Sep 29, 2026Updated Sep 29, 2026
Labelstype:bugneeds_triagecommunity

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

Bug Summary

Assisted-by: Claude Opus 5.5 — drafted with AI assistance; reproduced on a live controller, and every line cited was read at devel a5b2179a3e.

A job template with job_slice_count > 1, launched with a limit that matches fewer hosts than there are slices, produces a workflow job that fa ils. Each slice whose share of the inventory contains none of the limited hosts fails with ansible-core's ERROR! Specified inventory, host patter n and/or --limit leaves us with no hosts to target., although the hosts the limit names all ran successfully. The failure is noise, but it's indi stinguishable from a real one to anything watching job status.

The cause is the order of slicing and limiting:

  1. JobTemplate.get_effective_slice_ct caps the slice count at inventory.hosts.count() — the whole inventory, not the hosts the limit matches.
  2. Inventory.get_sliced_hosts partitions the inventory with host_queryset[offset::slice_count], ignoring the limit.
  3. Every slice job runs ansible-playbook with the full limit against only its partition. CLI.get_host_list in ansible-core raises when the lim it leaves no hosts, so the empty partitions exit 1.

AWX version

25.4.0

Select the relevant components

  • UI
  • UI (tech preview)
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

kubernetes

Modifications

yes

Ansible version

ansible-core 2.16.19 (execution environment)

Operating system

No response

Web browser

No response

Steps to reproduce

  1. A job template on an inventory of more than two hosts, with job_slice_count: 12 and ask_limit_on_launch: true.
  2. Launch it with limit: host-a.example.com,host-b.example.com, two hosts.

Expected results

The workflow job succeeds: the two hosts run, and no slice fails for having nothing to do. Either the slices are built from the hosts the limit ma tches, or a slice with no matching hosts finishes as successful with an explanation.

Actual results

The workflow job fails. 2 of 12 slices succeed, one per limited host; the other 10 fail with rc 1:

[WARNING]: Could not match supplied host pattern, ignoring: host-a.example.com
[WARNING]: Could not match supplied host pattern, ignoring: host-b.example.com
ERROR! Specified inventory, host pattern and/or --limit leaves us with no hosts to target.

Additional information

Two ways this could be fixed; I'd like to know which you'd accept before opening a PR:

  1. Limit before slicing. Evaluate the limit against the inventory, cap the slice count at the number of matching hosts, and partition only tho se. This gives the right result, but AWX has no evaluator for Ansible host patterns (groups, wildcards, ~regex, &, !, @file), so it would need one, or a call into ansible-core's inventory code.
  2. Treat an empty slice as successful. When a slice of a sliced job launched with a limit fails before any play starts, with this specific ans ible-core error, finish the slice as successful with a job_explanation such as "No hosts in this slice match the limit". Smaller, but it depends on recognizing the error.

A workaround today is to prompt for job_slice_count and launch limited runs with 1 slice.