# Cannot choose instance\_group id while launching AWX using cli

**URL:** <https://forum.ansible.com/t/cannot-choose-instance-group-id-while-launching-awx-using-cli/41495>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [April 3, 2025, 9:11am UTC](https://forum.ansible.com/t/cannot-choose-instance-group-id-while-launching-awx-using-cli/41495 "2025-04-03T09:11:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SaravanaSelvaraj](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/saravanaselvaraj/32/2841_2.png) [@SaravanaSelvaraj](https://forum.ansible.com/u/SaravanaSelvaraj)\
**Post date:** [April 3, 2025, 9:11am UTC](https://forum.ansible.com/t/cannot-choose-instance-group-id-while-launching-awx-using-cli/41495/1 "2025-04-03T09:11:13Z")

</div>

**awx job\_templates launch: argument --instance\_groups: invalid int value: ‘[3]’**  
Dear Ansible community,

I am trying to trigger awx cli with --instance\_groups argument, I tried with [3] but it is not working  
My AWX and Ansible versions are

```auto
AWX version : AWX 23.8.1
ansible --version
ansible [core 2.15.13]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.17 (main, Aug 9 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True

```

```auto
awx --conf.host [https://awx.us-XXXX.io](https://awx.us-xxxx.io/) --conf.username XXXXX --conf.password XXXX job_templates launch --name XXXXX --extra_vars '{"build_environment”:”XXXX”}’ --inventory XXXX --limit XXXX.com --instance_groups=[3]

Error : awx job_templates launch: argument --instance_groups: invalid int value: '[3]' 

```

I tried with many other options but nothing works. Please respond and help me with this.

---

<div class="post-metadata">

**Author:** ![SaravanaSelvaraj](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/saravanaselvaraj/32/2841_2.png) [@SaravanaSelvaraj](https://forum.ansible.com/u/SaravanaSelvaraj)\
**Post date:** [April 3, 2025, 9:12am UTC](https://forum.ansible.com/t/cannot-choose-instance-group-id-while-launching-awx-using-cli/41495/2 "2025-04-03T09:12:31Z")

</div>

@kurokobo , can you please check if you can help me on this one ?

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [April 4, 2025, 2:55pm UTC](https://forum.ansible.com/t/cannot-choose-instance-group-id-while-launching-awx-using-cli/41495/3 "2025-04-04T14:55:09Z")

</div>

I haven’t been able to investigate this deeply, but I think it’s likely a bug.

The awxkit treats arguments according to the API specifications, and `instance_groups` is indicated as a `field` type:

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/7/7e3d4724511c2569385c9e7fcd89ee5d5f1162ab.png)

However, the `field` type seems to be treated as an `int` on the awxkit side:

> <https://github.com/ansible/awx/blob/24.6.1/awxkit/awxkit/cli/options.py#L198>

So, actually we need to pass an array to `--instance_groups`, but `int` is not an array, so there seems to be no way to handle this.

I recommend invoking the job template with the pure REST API instead of awxkit, or assigning the instance groups to the job template first by REST API, and then invoking it by awxkit.

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [April 4, 2025, 3:00pm UTC](https://forum.ansible.com/t/cannot-choose-instance-group-id-while-launching-awx-using-cli/41495/4 "2025-04-04T15:00:53Z")

</div>

@djyasin  
Hi, I saw that you wrote “I tested” this feature in this issue:

> <https://github.com/ansible/awx/issues/15728>
>
> \### Please confirm the following
> 
> \- \[X\] I agree to follow this project's \[code o…f conduct\](https://docs.ansible.com/ansible/latest/community/code\_of\_conduct.html).
> \- \[X\] I have checked the \[current issues\](https://github.com/ansible/awx/issues) for duplicates.
> \- \[X\] I understand that AWX is open source software provided for free and that I might not receive a timely response.
> \- \[X\] I am \*\*NOT\*\* reporting a (potential) security vulnerability. (These should be emailed to \`security@ansible.com\` instead.)
> 
> \### Bug Summary
> 
> I've configured "Prompt on launch" on instance Groups. Everything work fine when I launch job template via UI
> 
> However when I tried to specific instance group on launch command.
> 
> \`\`\`
> awx job\_template launch \<name\> \\
> \--instance\_groups="4"
> \`\`\`
> I always get below error in return. What is the correct format to specific instance groups on awx cli?
> \`\`\`
> {"instance\_groups": \["Expected a list of items but got type \\"int\\"."\]}
> \`\`\`
> 
> 
> \### AWX version
> 
> 24.6.1
> 
> \### Select the relevant components
> 
> \- \[\] UI
> \- \[\] UI (tech preview)
> \- \[\] API
> \- \[\] Docs
> \- \[\] Collection
> \- \[X\] CLI
> \- \[\] Other
> 
> \### Installation method
> 
> kubernetes
> 
> \### Modifications
> 
> no
> 
> \### Ansible version
> 
> \_No response\_
> 
> \### Operating system
> 
> \_No response\_
> 
> \### Web browser
> 
> \_No response\_
> 
> \### Steps to reproduce
> 
> Create new job template and select "Prompt on launch" on instance Groups".
> 
> Use awx cli to launch job template and specific instance group ID e.g. 4.
> \`\`\`
> awx job\_template launch \<name\> \\
> \--instance\_groups="4"
> \`\`\`
> 
> 
> \### Expected results
> 
> We can submit launch request without issue.
> 
> \### Actual results
> 
> Got below error in return.
> 
> \`\`\`
> {"instance\_groups": \["Expected a list of items but got type \\"int\\"."\]}
> \`\`\`
> 
> \### Additional information
> 
> \_No response\_

but I (and @SaravanaSelvaraj) couldn’t get it to work.

If it seems like we’re going down the wrong path, please let me know.
