Skip to content

ansible ansible-playbook crashing with exception #407

@stratacast

Description

@stratacast

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
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions