# Adding body: to uri: task results in Status code was -1 and not \[200\]: An unknown error occurred: unhashable type

**URL:** <https://forum.ansible.com/t/adding-body-to-uri-task-results-in-status-code-was-1-and-not-200-an-unknown-error-occurred-unhashable-type/32209>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [February 12, 2020, 7:34am UTC](https://forum.ansible.com/t/adding-body-to-uri-task-results-in-status-code-was-1-and-not-200-an-unknown-error-occurred-unhashable-type/32209 "2020-02-12T07:34:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen\_Elves](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@Stephen\_Elves](https://forum.ansible.com/u/Stephen_Elves)\
**Post date:** [February 12, 2020, 7:34am UTC](https://forum.ansible.com/t/adding-body-to-uri-task-results-in-status-code-was-1-and-not-200-an-unknown-error-occurred-unhashable-type/32209/1 "2020-02-12T07:34:08Z")

</div>

Hi,

Tearing what little hair I have left:

This is the fragment of the playbook:

- name: create new RE if RE doesn’t exist  
uri:  
url: [https://api.eu.cloud.talend.com/tmc/v1.3/runtimes/remote-engines](https://api.eu.cloud.talend.com/tmc/v1.3/runtimes/remote-engines)  
method: POST  
headers:  
Authorization: Basic {{talend\_personal\_access\_token}}  
Accept: application/json  
status-code: 201  
body-format: json  
**body:**  
**name: “{{RE\_name}}”**  
register: new\_RE\_response

when: check\_response.json[0].id is undefined

If I remove the body: part then, well it doesn’t work but the failure is a response code from the webservice (415), with it in I get:

{ “status”: -1, “exception”: “Traceback (most recent call last):\n File "/tmp/ansible\_uri\_payload\_nEptqB/ansible\_uri\_payload.zip/ansible/module\_utils/urls.py", line 1359, in fetch\_url\n unix\_socket=unix\_socket)\n File "/tmp/ansible\_uri\_payload\_nEptqB/ansible\_uri\_payload.zip/ansible/module\_utils/urls.py", line 1257, in open\_url\n use\_gssapi=use\_gssapi, unix\_socket=unix\_socket)\n File "/tmp/ansible\_uri\_payload\_nEptqB/ansible\_uri\_payload.zip/ansible/module\_utils/urls.py", line 1163, in open\n r = urllib\_request.urlopen(\*urlopen\_args)\n File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen\n return opener.open(url, data, timeout)\n File "/usr/lib64/python2.7/urllib2.py", line 431, in open\n response = self.\_open(req, data)\n File "/usr/lib64/python2.7/urllib2.py", line 449, in \_open\n ‘\_open’, req)\n File "/usr/lib64/python2.7/urllib2.py", line 409, in \_call\_chain\n result = func(\*args)\n File "/tmp/ansible\_uri\_payload\_nEptqB/ansible\_uri\_payload.zip/ansible/module\_utils/urls.py", line 356, in https\_open\n return self.do\_open(CustomHTTPSConnection, req)\n File "/usr/lib64/python2.7/urllib2.py", line 1211, in do\_open\n h.request(req.get\_method(), req.get\_selector(), req.data, headers)\n File "/usr/lib64/python2.7/httplib.py", line 1056, in request\n self.\_send\_request(method, url, body, headers)\n File "/usr/lib64/python2.7/httplib.py", line 1090, in \_send\_request\n self.endheaders(body)\n File "/usr/lib64/python2.7/httplib.py", line 1052, in endheaders\n self.\_send\_output(message\_body)\n File "/usr/lib64/python2.7/httplib.py", line 894, in \_send\_output\n self.send(message\_body)\n File "/usr/lib64/python2.7/httplib.py", line 866, in send\n self.sock.sendall(data)\n File "/usr/lib64/python2.7/ssl.py", line 744, in sendall\n v = self.send(data[count:])\nTypeError: unhashable type\n”, “url”: “[https://api.eu.cloud.talend.com/tmc/v1.3/runtimes/remote-engines](https://api.eu.cloud.talend.com/tmc/v1.3/runtimes/remote-engines)”, “changed”: false, “elapsed”: 1, “content”: “”, “invocation”: { “module\_args”: { “directory\_mode”: null, “force”: false, “remote\_src”: null, “status\_code”: [200], “follow”: false, “owner”: null, “body\_format”: “raw”, “body-format”: “json”, “client\_key”: null, “group”: null, “use\_proxy”: true, “headers”: { “Accept”: “application/json”, “Authorization”: “Basic ” }, “unsafe\_writes”: null, “setype”: null, “content”: null, “serole”: null, “follow\_redirects”: “safe”, “return\_content”: false, “client\_cert”: null, “body”: { “name”: “RHEL\_X.X.X.X\_AZGLGBNEVTA30\_PRODUCTION\_C4E” }, “timeout”: 30, “src”: null, “dest”: null, “selevel”: null, “force\_basic\_auth”: true, “removes”: null, “http\_agent”: “ansible-httpget”, “regexp”: null, “status-code”: 201, “url\_password”: null, “url”: “[https://api.eu.cloud.talend.com/tmc/v1.3/runtimes/remote-engines](https://api.eu.cloud.talend.com/tmc/v1.3/runtimes/remote-engines)”, “validate\_certs”: true, “seuser”: null, “method”: “POST”, “creates”: null, “unix\_socket”: null, “delimiter”: null, “mode”: null, “url\_username”: null, “attributes”: null, “backup”: null } }, “redirected”: false, **“msg”: “Status code was -1 and not [200]: An unknown error occurred: unhashable type”,** “\_ansible\_no\_log”: false }

For reference:  
ansible --version ansible 2.9.4 config file = /etc/ansible/ansible.cfg configured module search path = [u’/home/jason\_ho/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

This is running through AWX 9.1.1

Am I doing something wrong or have I ran into a bug?

Cheers

Stephen
