# Executing meta: end\_play triggers AnsibleError

**URL:** <https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889>\
**Category:** Get Help\
**Created:** [November 24, 2025, 5:17pm UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889 "2025-11-24T17:17:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![oza4h07](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/oza4h07/32/1118_2.png) [@oza4h07](https://forum.ansible.com/u/oza4h07)\
**Post date:** [November 24, 2025, 5:17pm UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/1 "2025-11-24T17:17:43Z")

</div>

**Executing meta: end\_play triggers AnsibleError**.  
I’m using an old Debian 11.11 host on which I installed years ago, Debian’s ansible package.  
On this box, ansible 2.10.17 is installed along python 3.9.2.

As I couldn’t configure Trixie boxes with this setup, I installed in a dedicated Python venv, latest Ansible with `uv pip install ansible`.  
After activating this venv, I’m seeing the (redacted) error bellow whenever `meta: end_play` is met ins any of my scripts.

`[ERROR]: Unexpected Exception, this is probably a bug: 0

Traceback (most recent call last):  
File “/home/foobar/PythonEnvs/ansiblevenv/lib/python3.11/site-packages/ansible/cli/ **init**.py”, line 660, in cli\_executor  
exit\_code = cli.run()  
^^^^^^^^^  
File “/home/foobar/PythonEnvs/ansiblevenv/lib/python3.11/site-packages/ansible/cli/adhoc.py”, line 199, in run  
result = self.\_tqm.run(play)  
^^^^^^^^^^^^^^^^^^^  
File “/home/foobar/PythonEnvs/ansiblevenv/lib/python3.11/site-packages/ansible/executor/task\_queue\_manager.py”, line 396, in run  
raise AnsibleEndPlay(play\_return)  
ansible.executor.task\_queue\_manager.AnsibleEndPlay: 0

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “/home/foobar/PythonEnvs/ansiblevenv/lib/python3.11/site-packages/ansible/cli/ **init**.py”, line 669, in cli\_executor  
raise AnsibleError(“Unexpected Exception, this is probably a bug.”) from ex  
ansible.errors.AnsibleError: Unexpected Exception, this is probably a bug: 0`

What can I do about this ?

---

<div class="post-metadata">

**Author:** ![markstos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/markstos/32/9706_2.png) [@markstos](https://forum.ansible.com/u/markstos)\
**Post date:** [November 24, 2025, 5:27pm UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/2 "2025-11-24T17:27:30Z")

</div>

You might accidentally be running the older system ansible binary. Check with these commands. They should both point to the newer version in your venv:

```auto
# Inside the virtual‑env (or after any “source” you use)
which ansible # full path to the binary
ansible --version # shows ansible‑core and collection versions

```

---

<div class="post-metadata">

**Author:** ![oza4h07](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/oza4h07/32/1118_2.png) [@oza4h07](https://forum.ansible.com/u/oza4h07)\
**Post date:** [November 25, 2025, 9:08am UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/3 "2025-11-25T09:08:17Z")

</div>

Thank you very much for replying.

(Redacted) output:

`$ source /home/foobar/PythonEnvs/ansiblevenv/bin/activate `$ which ansible  
/home/foobar/PythonEnvs/ansiblevenv/bin/ansible  
`(ansiblevenv)$ ansible --version ansible [core 2.19.4] config file = None configured module search path = ['/home/foobar/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/foobar/PythonEnvs/ansiblevenv/lib/python3.11/site-packages/ansible ansible collection location = /home/foobar/.ansible/collections:/usr/share/ansible/collections executable location = /home/foobar/PythonEnvs/ansiblevenv/bin/ansible python version = 3.11.11 (main, Mar 17 2025, 21:02:09) [Clang 20.1.0] (/home/foobar/PythonEnvs/ansiblevenv/bin/python3) jinja version = 3.1.6 pyyaml version = 6.0.3 (with libyaml v0.2.5)`

It seems latest ansible is correctly preferred but somehow mixed with the old one.  
For instance, `configured module search path` and `ansible collection location` both refer to the `.ansible` directory used by the old ansible instance.

In this specific case, it seems more appropriate values should be  
`configured module search path = ['/home/foobar/PythonEnvs/ansiblevenv/<something>/plugins/modules']`  
`ansible collection location = /home/foobar/PythonEnvs/ansiblevenv/<something else>/collections`

1. Looking at venv content, I’m not sure I can set `<something>` and `<something else>` to anything valid.
2. Is there a recommended way to set a config file within an Ansible venv ?

---

<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 25, 2025, 5:28pm UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/4 "2025-11-25T17:28:13Z")

</div>

I can’t under-emphasize this enough. I’m not recommending it as a best- or even mediocre-practice. But it’s because of “stuff like this” that I treat the presence of any `ansible.cfg` file as an error. Any Ansible configuration I need to do I do through environment variables. Maybe it’s just a “me” thing, but having one source of truth for config is about my mental limit these days.

Also, make liberal use of `ansible-config` a habit, especially

```
$ ansible-config dump --only-changed

```

---

<div class="post-metadata">

**Author:** ![oza4h07](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/oza4h07/32/1118_2.png) [@oza4h07](https://forum.ansible.com/u/oza4h07)\
**Post date:** [December 2, 2025, 12:55pm UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/5 "2025-12-02T12:55:48Z")

</div>

On a new Debian Trixie host, I ran `àpt install ansible` and Ansible seems to work OK.

Strangely, it seems `ansible.builtin.meta: end_play` doesn’t work anymore while `ansible.builtin.meta: end_host` does (I must precise I never used `end_host` before).

When running `end_play`, Ive got:

[ERROR]: Unexpected Exception, this is probably a bug: 0

Traceback (most recent call last):  
File “/usr/lib/python3/dist-packages/ansible/cli/ **init**.py”, line 660, in cli\_executor  
exit\_code = cli.run()  
File “/usr/lib/python3/dist-packages/ansible/cli/adhoc.py”, line 199, in run  
result = self.\_tqm.run(play)  
File “/usr/lib/python3/dist-packages/ansible/executor/task\_queue\_manager.py”, line 396, in run  
raise AnsibleEndPlay(play\_return)  
ansible.executor.task\_queue\_manager.AnsibleEndPlay: 0

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “/usr/lib/python3/dist-packages/ansible/cli/ **init**.py”, line 669, in cli\_executor  
raise AnsibleError(“Unexpected Exception, this is probably a bug.”) from ex  
ansible.errors.AnsibleError: Unexpected Exception, this is probably a bug: 0

I can rewrite all my roles or playbooks to use `end_host` instead but before doing so, what do you recommend me to do ?  
Can someone reproduce this ?

Best regards

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [December 3, 2025, 11:03pm UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/6 "2025-12-03T23:03:13Z")

</div>

I think it’s a bug. I’ve opened a possible fix: [adhoc - fix traceback for meta end\_play tasks by s-hertel · Pull Request #86294 · ansible/ansible · GitHub](https://github.com/ansible/ansible/pull/86294).

You can avoid the issue by using `ansible-playbook` instead of `ansible` (adhoc).

---

<div class="post-metadata">

**Author:** ![oza4h07](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/oza4h07/32/1118_2.png) [@oza4h07](https://forum.ansible.com/u/oza4h07)\
**Post date:** [December 4, 2025, 8:25am UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/7 "2025-12-04T08:25:00Z")

</div>

I’ve not tried the fix yet, but as this issue has been reproduced elsewhere, I’ll find a workround.  
Thanks for taking a look at it.

---

<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:** [January 3, 2026, 8:25am UTC](https://forum.ansible.com/t/executing-meta-end-play-triggers-ansibleerror/44889/8 "2026-01-03T08:25:13Z")

</div>

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