diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index c4f11c1c8ed..4b29e8b74f8 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -34,7 +34,10 @@ def load_list_of_blocks(ds, play, parent_block=None, role=None, task_include=Non # we import here to prevent a circular dependency with imports from ansible.playbook.block import Block - assert isinstance(ds, (list, type(None))) + try: + assert isinstance(ds, (list, type(None))) + except AssertionError: + raise AnsibleParserError("Task list is not a list, invalid format provided: %s" % ds) block_list = [] if ds: