# ansible.builtin.gather\_facts fails with "Module result deserialization failed: No start of json char found"

**URL:** <https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849>\
**Category:** Get Help\
**Tags:** windows\
**Created:** [November 17, 2025, 1:23pm UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849 "2025-11-17T13:23:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timoses](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Timoses](https://forum.ansible.com/u/Timoses)\
**Post date:** [November 17, 2025, 1:23pm UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/1 "2025-11-17T13:23:43Z")

</div>

**Please replace this text with a description of your issue**. You should:

Since upgrade from Debian 12 to Debian 13 we receive the following when running a playbook against a Windows system:

```auto
[WARNING]: Deprecation warnings can be disabled by setting `deprecation_warnings=False` in ansible.cfg.
[DEPRECATION WARNING]: DEFAULT_MANAGED_STR option. Reason: The `ansible_managed` variable can be set just like any other variable, or a different variable can be used.
Alternatives: Set the `ansible_managed` variable, or use any custom variable in templates. This feature will be removed from ansible-core version 2.23.

[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
[DEPRECATION WARNING]: The tree callback plugin is deprecated. This feature will be removed from ansible-core version 2.23.

PLAY [Configure Computer] **********************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************************************************************
[WARNING]: Unhandled error in Python interpreter discovery for host 'timowin11': unexpected output from Python interpreter discovery

Unhandled error in Python interpreter discovery for host 'timowin11'.

<<< caused by >>>

unexpected output from Python interpreter discovery

[WARNING]: Host 'timowin11' is using the discovered Python interpreter at '/usr/bin/python3', but future installation of another Python interpreter could cause a different interpreter to be discovered. See https://docs.ansible.com/ansible-core/2.19/reference_appendices/interpreter_discovery.html for more information.
[ERROR]: Task failed: Action failed: The following modules failed to execute: ansible.legacy.setup.

Task failed: Action failed.

<<< caused by >>>

The following modules failed to execute: ansible.legacy.setup.

+--[Sub-Event 1 of 1]---
|
| Module result deserialization failed: No start of json char found See stdout/stderr for the returned output.
|
+--[End Sub-Event]---

fatal: [timowin11]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "exception": "(traceback unavailable)", "failed": true, "module_stderr": "/bin/sh : The term '/bin/sh' is not recognized as the name of a cmdlet, function, script file, or \r\noperable program. Check the spelling of the name, or if a path was included, verify that the path \r\nis correct and try again.\r\nAt line:1 char:1\r\n+ /bin/sh -c '/usr/bin/python3 && sleep 0'\r\n+ ~~~~~~~ \r\n + CategoryInfo : ObjectNotFound: (/bin/sh:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\n", "module_stdout": "", "msg": "Module result deserialization failed: No start of json char found", "rc": 1}}, "msg": "The following modules failed to execute: ansible.legacy.setup."}

PLAY RECAP *************************************************************************************************************************************************************************************************************************************
timowin11 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

```

```auto
ansible --version
ansible [core 2.19.4]
  config file = /opt/code/ceos/admin/ansible.cfg
  configured module search path = ['/home/timoses/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /opt/code/ceos/admin/collections:/home/timoses/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] (/usr/bin/python3)
  jinja version = 3.1.6
  pyyaml version = 6.0.2 (with libyaml v0.2.5)

```

Any ideas what the cause may be?

---

<div class="post-metadata">

**Author:** ![Lyle\_McKarns](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lyle_mckarns/32/8142_2.png) [@Lyle\_McKarns](https://forum.ansible.com/u/Lyle_McKarns)\
**Post date:** [November 17, 2025, 2:30pm UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/2 "2025-11-17T14:30:18Z")

</div>

Did your ansible version change when you did your upgrade, or just the OS version its running on?

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [November 17, 2025, 2:52pm UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/3 "2025-11-17T14:52:34Z")

</div>

Hey, @Timoses . Welcome to the forum.

Is `timowin11` a Windows host? If so, should it be looking for `/bin/sh`?  
How is your connection to `timowin11` configured?

---

<div class="post-metadata">

**Author:** ![Timoses](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Timoses](https://forum.ansible.com/u/Timoses)\
**Post date:** [November 18, 2025, 8:09am UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/4 "2025-11-18T08:09:41Z")

</div>

It is a windows11 machine.

Usually the gather\_facts module should forward to the windows setup module. However, it does not seem to do this.

Of course `/bin/sh` is doomed to fail on Windows..

What is odd is that towards another windows11 machine it works without problems:

```auto
TASK [my_col.base.all : ansible.builtin.gather_facts] ********************************************************************************************************************************************************************************************
task path: /opt/code/ansible/collections/ansible_collections/my_col/base/roles/all/tasks/main.yml:28
redirecting (type: modules) ansible.builtin.setup to ansible.windows.setup
ok: [lama1.nodomain]

```

I’m not sure how the logic of detecting which gather\_facts module Ansible uses works, but it seems to fail in this instance and I’m not sure why.

---

<div class="post-metadata">

**Author:** ![Timoses](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Timoses](https://forum.ansible.com/u/Timoses)\
**Post date:** [November 18, 2025, 8:11am UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/5 "2025-11-18T08:11:04Z")

</div>

Yes, Ansible version changed:

Bookworm: 2.14 [Debian -- Details of package ansible-core in bookworm](https://packages.debian.org/bookworm/ansible-core)  
Trixie: 2.19 [Debian -- Details of package ansible-core in trixie](https://packages.debian.org/trixie/ansible-core)

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [November 18, 2025, 1:04pm UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/6 "2025-11-18T13:04:42Z")

</div>

Review [Windows SSH — Ansible Community Documentation](https://docs.ansible.com/projects/ansible/latest/os_guide/windows_ssh.html) and ensure your controller is configured to handle `timowin11` as a Windows machine.

---

<div class="post-metadata">

**Author:** ![Timoses](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Timoses](https://forum.ansible.com/u/Timoses)\
**Post date:** [November 18, 2025, 1:43pm UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/7 "2025-11-18T13:43:07Z")

</div>

Yeah, sorry. I accidentally forgot to add the host to the `[windows]` group which defines these variables.

Thanks for the hint!!

---

<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:** [December 18, 2025, 1:43pm UTC](https://forum.ansible.com/t/ansible-builtin-gather-facts-fails-with-module-result-deserialization-failed-no-start-of-json-char-found/44849/8 "2025-12-18T13:43:26Z")

</div>

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