# How to display JSON when async does not return valid JSON

**URL:** <https://forum.ansible.com/t/how-to-display-json-when-async-does-not-return-valid-json/21011>\
**Category:** Ansible Project\
**Created:** [March 29, 2016, 8:32pm UTC](https://forum.ansible.com/t/how-to-display-json-when-async-does-not-return-valid-json/21011 "2016-03-29T20:32:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed1](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ed1](https://forum.ansible.com/u/Ed1)\
**Post date:** [March 29, 2016, 8:32pm UTC](https://forum.ansible.com/t/how-to-display-json-when-async-does-not-return-valid-json/21011/1 "2016-03-29T20:32:13Z")

</div>

Hi,

I’m trying to debug a problem where Ansible is reporting that the async task failed to return valid JSON. Is there a way to see the invalid JSON content that was returned? I’m running into a response similar to what’s described in [this post](https://groups.google.com/forum/#!topic/ansible-project/9CBjD5hYPEA). From trial and error, I know that an RPM I deploy earlier in the play somehow contributes to the failure. I suspect whatever output is in the invalid JSON response would provide guidance as to what’s going on with the failing RPM / Ansible async interaction.

I am using become\_user, with a loop, so at first [issue #13965](https://github.com/ansible/ansible/issues/13965) looked to be relevant. However, I’m running 2.0.1.0, so I should have that fix. And if I change the play to install a different RPM or if I simply re-run the playbook after the first failure, the task succeeds. I know the issue is not particular to this one task, since when I comment out this task, things fail similarly on the next task - which also uses become\_user, with a loop.

Thanks,  
Ed

TASK [target\_node : Execute retrieve script] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [target] =\> (item={u’SERVICE\_NAME’: u’testing’, u’NODE\_TYPE’: u’P’, u’PORT’: 1432, u’NODE\_NUMBER’: 0}) =\> {“failed”: true, “item”: {“NODE\_NUMBER”: 0, “NODE\_TYPE”: “P”, “PORT”: 1432, “SERVICE\_NAME”: “testing”}, “msg”: “The async task did not return valid JSON: Extra data: line 2 column 1 - line 3 column 1 (char 67 - 183)”}  
failed: [target] =\> (item={u’SERVICE\_NAME’: u’testing’, u’NODE\_TYPE’: u’S’, u’PORT’: 1433, u’NODE\_NUMBER’: 1}) =\> {“failed”: true, “item”: {“NODE\_NUMBER”: 1, “NODE\_TYPE”: “S”, “PORT”: 1433, “SERVICE\_NAME”: “testing”}, “msg”: “The async task did not return valid JSON: Extra data: line 2 column 1 - line 3 column 1 (char 67 - 183)”}  
failed: [target] =\> (item={u’SERVICE\_NAME’: u’testing’, u’NODE\_TYPE’: u’S’, u’PORT’: 1434, u’NODE\_NUMBER’: 2}) =\> {“failed”: true, “item”: {“NODE\_NUMBER”: 2, “NODE\_TYPE”: “S”, “PORT”: 1434, “SERVICE\_NAME”: “testing”}, “msg”: “The async task did not return valid JSON: Extra data: line 2 column 1 - line 3 column 1 (char 67 - 183)”}  
…ignoring

---

<div class="post-metadata">

**Author:** ![Ed1](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ed1](https://forum.ansible.com/u/Ed1)\
**Post date:** [April 4, 2016, 6:18pm UTC](https://forum.ansible.com/t/how-to-display-json-when-async-does-not-return-valid-json/21011/2 "2016-04-04T18:18:23Z")

</div>

The root problem turned out to be a permissions issue. The RPM in question is altering the permissions on the home directory of the account used for the async task, which makes it impossible for the account to create the ~/.ansible\_async/ directory. I assume that the failure to create the directory is what’s hidden behind the invalid JSON message that Ansible returned.
