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

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:

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:

formatted_source_context=None,
formatted_traceback=None,

My versions on an Arch default install:

$ 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

Can you enable the DISPLAY_TRACEBACK setting to error? The easiest way to do this is set the env var when running Ansible

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

Thank you, Jordan!

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

[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! :smiley:

Relevant issues:

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

1 Like

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

1 Like

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

1 Like