# Gatering facts throws exception "Task failed: not enough values to unpack (expected 4, got 2)"

**URL:** <https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708>\
**Category:** Get Help\
**Tags:** error, facts\
**Created:** [October 20, 2025, 7:35am UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708 "2025-10-20T07:35:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![haasalex](https://avatars.discourse-cdn.com/v4/letter/h/6bbea6/32.png) [@haasalex](https://forum.ansible.com/u/haasalex)\
**Post date:** [October 20, 2025, 7:35am UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708/1 "2025-10-20T07:35:33Z")

</div>

I get an exception when I run my playbook: “Task failed: not enough values to unpack (expected 4, got 2)”

When I run `ansible myhost -m ping -i hosts.yml -u root`, everthing is ok.

When I run any playbook (even targeting my OpenWRT-hosts which don’t have Python installed) it looks like this:

```auto
TASK [Gathering Facts] *********************************************************************************************************************************************************************************************
task path: /home/alex/infrastructure/site.yml:75
<myhost> ESTABLISH SSH CONNECTION FOR USER: root
<myhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/alex/.ansible/cp/f356a65c1b"' -o NumberOfPasswordPrompts=1 myhost '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<myhost> (0, b'/root\n', b'')
<myhost> ESTABLISH SSH CONNECTION FOR USER: root
<myhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/alex/.ansible/cp/f356a65c1b"' -o NumberOfPasswordPrompts=1 myhost '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1760893884.438878-21775-191142939758709 `" && echo ansible-tmp-1760893884.438878-21775-191142939758709="` echo /root/.ansible/tmp/ansible-tmp-1760893884.438878-21775-191142939758709 `" ) && sleep 0'"'"''
<myhost> (0, b'ansible-tmp-1760893884.438878-21775-191142939758709=/root/.ansible/tmp/ansible-tmp-1760893884.438878-21775-191142939758709\n', b'')
<myhost> ESTABLISH SSH CONNECTION FOR USER: root
<myhost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/alex/.ansible/cp/f356a65c1b"' -o NumberOfPasswordPrompts=1 myhost '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1760893884.438878-21775-191142939758709/ > /dev/null 2>&1 && sleep 0'"'"''
<myhost> (0, b'', b'')
[ERROR]: Task failed: not enough values to unpack (expected 4, got 2)
fatal: [myhost]: FAILED! => {
"changed": false,
"msg": "Task failed: not enough values to unpack (expected 4, got 2)"
}

```

When I start it using the debugger, all I get is that Ansible itself does not know where or why this error did happen:

```auto
formatted_source_context=None,
formatted_traceback=None,

```

My versions on an Arch default install:

```auto
$ ansible --version
ansible [core 2.19.3]
config file = /home/alex/infrastructure/ansible.cfg
configured module search path = ['/home/alex/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.13/site-packages/ansible
ansible collection location = /home/alex/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813] (/usr/bin/python)
jinja version = 3.1.6
pyyaml version = 6.0.3 (with libyaml v0.2.5)

```

How would I diagnose this any further?

Best regards,

Alex

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [October 20, 2025, 8:32pm UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708/2 "2025-10-20T20:32:21Z")

</div>

Can you enable the [DISPLAY\_TRACEBACK](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#display-traceback) setting to `error`? The easiest way to do this is set the env var when running Ansible

```bash
ANSIBLE_DISPLAY_TRACEBACK=error ansible myhost -m ping -i hosts.yml -u root

```

---

<div class="post-metadata">

**Author:** ![haasalex](https://avatars.discourse-cdn.com/v4/letter/h/6bbea6/32.png) [@haasalex](https://forum.ansible.com/u/haasalex)\
**Post date:** [October 21, 2025, 8:06am UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708/3 "2025-10-21T08:06:55Z")

</div>

Thank you, Jordan!

That was the setting I was missing. Now I know that “good” old `gekmihesg.openwrt` is causing it:

```auto
[ERROR]: Task failed: not enough values to unpack (expected 4, got 2)

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/ansible/executor/task_executor.py", line 424, in _execute
    result = self._execute_internal(templar, variables)
  File "/usr/lib/python3.13/site-packages/ansible/executor/task_executor.py", line 622, in _execute_internal
    result = self._handler.run(task_vars=vars_copy)
  File "/usr/lib/python3.13/site-packages/ansible/plugins/action/gather_facts.py", line 129, in run
    res = self._execute_module(module_name=fact_module, module_args=mod_args, task_vars=task_vars, wrap_async=False)
  File "/usr/lib/python3.13/site-packages/ansible/plugins/action/ __init__.py", line 1053, in _execute_module
    module_bits, module_path = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
                               ~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/.ansible/roles/gekmihesg.openwrt/vars_plugins/monkeypatch.py", line 33, in _configure_module
    (module_style, module_shebang, module_data, module_path) = \
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 4, got 2)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/ansible/executor/task_executor.py", line 429, in _execute
    raise AnsibleTaskError(obj=self._task.get_ds()) from ex
ansible.errors.AnsibleTaskError: Task failed: not enough values to unpack (expected 4, got 2)

fatal: [myhost] FAILED! => {
    "changed": false,
    "msg": "Task failed: not enough values to unpack (expected 4, got 2)"
}

```

I was suspicious about gekmihesg.openwrt all along. But since I used a host which is not using it, I did hope that it would not interfere.

Now to find a way to make this work with current Ansible…

Thank you, once again! 😃

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [October 21, 2025, 5:08pm UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708/4 "2025-10-21T17:08:38Z")

</div>

> [@haasalex](#):
>
> `gekmihesg.openwrt`

Relevant issues:

- [Compatibility with ansible \>= 2.19 · Issue #78 · gekmihesg/ansible-openwrt · GitHub](https://github.com/gekmihesg/ansible-openwrt/issues/78) (basically the error you’re describing)
- [Is this repo still maintained? · Issue #75 · gekmihesg/ansible-openwrt · GitHub](https://github.com/gekmihesg/ansible-openwrt/issues/75)

CC @russoz who seems to be interested in this topic as well.

---

<div class="post-metadata">

**Author:** ![haasalex](https://avatars.discourse-cdn.com/v4/letter/h/6bbea6/32.png) [@haasalex](https://forum.ansible.com/u/haasalex)\
**Post date:** [October 22, 2025, 5:57am UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708/5 "2025-10-22T05:57:12Z")

</div>

Thank you very much, Felix, for taking the time to link this.  
It doesn’t look so dire after all… 😄

---

<div class="post-metadata">

**Author:** ![russoz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russoz/32/127_2.png) [@russoz](https://forum.ansible.com/u/russoz)\
**Post date:** [October 22, 2025, 8:27pm UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708/6 "2025-10-22T20:27:54Z")

</div>

I have just submitted a request for a community.openwrt git repository - we’re planning on creating a collection for openwrt:

> [@Requesting repo community.openwrt](https://forum.ansible.com/t/requesting-repo-community-openwrt/44725/1):
>
> Hi everyone, I have been using the role [gekmihesg.openwrt](https://github.com/gekmihesg/ansible-openwrt) to configure my OpenWRT router at home. The role, however, [seems to be unmaintained](https://github.com/gekmihesg/ansible-openwrt/issues/75). Some folks have forked the repo and are releasing a new role with changes out there. In that context I suggested creating a collection and that seemed to be well received, so the idea is to consolidate the development of OpenWRT code in this collection. As many routers do not have Python installed nor they have enough space to install it (that’s my cas…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 21, 2025, 8:28pm UTC](https://forum.ansible.com/t/gatering-facts-throws-exception-task-failed-not-enough-values-to-unpack-expected-4-got-2/44708/7 "2025-11-21T20:28:54Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
