ERROR! Unexpected Exception, this is probably a bug: unhashable type: 'dict'

Running Ansible 2.4.2.0 on OSX 10.13.2 (via macports), python version 3.6.4.

I’m running a playbook of some 100-odd tasks and this error occurs at some point in that operation. I can repeatedly run the playbook and get successively closer to the end.

Some operations must run; if everything is skipped then no error occurs. The stack trace usually seems to point to a handler, but I can’t spot the error.

With “-vvv”:

the full traceback was:
Traceback (most recent call last):
File “/opt/local/bin/ansible-playbook”, line 106, in
exit_code = cli.run()
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/cli/playbook.py”, line 130, in run
results = pbex.run()
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/executor/playbook_executor.py”, line 154, in run
result = self._tqm.run(play=play)
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/executor/task_queue_manager.py”, line 290, in run
play_return = strategy.run(iterator, play_context)
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/plugins/strategy/linear.py”, line 292, in run
results += self._wait_on_pending_results(iterator)
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/plugins/strategy/init.py”, line 586, in _wait_on_pending_results
results = self._process_pending_results(iterator)
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/plugins/strategy/init.py”, line 470, in _process_pending_results
if handler_name in self._listening_handlers:
TypeError: unhashable type: ‘dict’

It would seem that the error is happening when notifications are collected, e.g. one task after which the failure occurs. Note that this is one task in the middle of several which do the “notify”:

  • name: install hiredis 0.13 shared library
    become: yes
    copy: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }}
    with_items:
  • { src: “libhiredis.so.0.13”, dest: “/usr/lib64/”, mode: ‘0755’ }
    tags: provision, hiredis, redis_fdw
    notify:
  • name: restart postgres

The handler definition:

You need to drop the name: from your notify:

notify:

- restart postgres

Thanks! I was totally blind to that…