Repository navigation
Closed
Description
When I run ansible-playbook with the latest builds, I get this traceback:
[ERROR]: Unexpected Exception, this is probably a bug: function() argument 'code' must be code, not str
Traceback (most recent call last):
File "/opt/local/lib/python3.13/site-packages/ansible/cli/__init__.py", line 660, in cli_executor
exit_code = cli.run()
File "/opt/local/lib/python3.13/site-packages/ansible/cli/playbook.py", line 153, in run
results = pbex.run()
File "/opt/local/lib/python3.13/site-packages/ansible/executor/playbook_executor.py", line 117, in run
self._tqm.load_callbacks()
~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/opt/local/lib/python3.13/site-packages/ansible/executor/task_queue_manager.py", line 206, in load_callbacks
stdout_callback = callback_loader.get(self._stdout_callback_name)
File "/opt/local/lib/python3.13/site-packages/ansible/plugins/loader.py", line 979, in get
ctx = self.get_with_context(name, *args, **kwargs)
File "/opt/local/lib/python3.13/site-packages/ansible/plugins/loader.py", line 1024, in get_with_context
self._module_cache[path] = self._load_module_source(python_module_name=plugin_load_context._python_module_name, path=path)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/local/lib/python3.13/site-packages/ansible/plugins/loader.py", line 943, in _load_module_source
spec.loader.exec_module(module)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "<frozen importlib._bootstrap_external>", line 1027, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/root/.ansible/collections/ansible_collections/community/general/plugins/callback/yaml.py", line 54, in <module>
class MyDumper(AnsibleDumper):
...<21 lines>...
return node
TypeError: function() argument 'code' must be code, not str
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/local/lib/python3.13/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: function() argument 'code' must be code, not str
Metadata
Metadata
Assignees
Labels
No labels
Activity
jperkin commentedon Nov 12, 2025
I think this is being caused by whatever version of ansible collections you have installed in
/root/.ansible/collectionsfrom the stack trace. That file is already shipped as part of ansible, i.e./opt/local/lib/python3.13/site-packages/ansible_collections/community/general/plugins/callback/yaml.py. Could you try removing it?stratacast commentedon Nov 13, 2025
Ah, that came to bite me. Well that solved one issue, onto a newer one. I've attempted targeting multiple target OSes (native zone, OpenBSD, Linux) and am getting this error
I spent some time poking through some searches on this issue, and it is not yet clear to me why this one is appearing
stratacast commentedon Dec 4, 2025
Thought I'd mention the issue is still persisting after the latest updates to trunk. I may create a new zone for now on older quarterly branch since my SSL certs are about to expire :)
x11/xterm: update to 410
(math/R-xts) Updated 0.13.1 to 0.14.1
(textproc/R-htmltools) Updated 0.5.4 to 0.5.8.1
net/nsd: Update to version 4.11.1.
www/ruby-httpclient: update to 2.9.0
nghttp3: update to 1.13.1.
devel/bacon: update to 3.20.3
jjui: update to 0.9.10.
chat/iamb: update to 0.0.11
x11/xterm: update to 410
moor: update to 2.13.2.
x11/xterm: update to 410
moor: update to 2.13.2.
p5-Template-Toolkit: update to 3.106.
(math/R-igraph) Updated 2.1.4 to 2.3.2, Fix Build against R-4.6.0
py-pillow_heif: update to 1.4.0.
www/litehtml: Update v0.10
OpenJPH: update to 0.33.0.