# Ansible-lint hook no longer works with pre-commit 4.3.0

**URL:** <https://forum.ansible.com/t/ansible-lint-hook-no-longer-works-with-pre-commit-4-3-0/44792>\
**Category:** Get Help\
**Tags:** ansible-lint\
**Created:** [November 5, 2025, 9:40am UTC](https://forum.ansible.com/t/ansible-lint-hook-no-longer-works-with-pre-commit-4-3-0/44792 "2025-11-05T09:40:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![falon](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/falon/32/2081_2.png) [@falon](https://forum.ansible.com/u/falon)\
**Post date:** [November 5, 2025, 9:40am UTC](https://forum.ansible.com/t/ansible-lint-hook-no-longer-works-with-pre-commit-4-3-0/44792/1 "2025-11-05T09:40:54Z")

</div>

Hello,

I have recently update pre-commit from 4.2.0 to 4.3.0. I use it with `ansible-lint` in this way:

```yaml
- repo: https://github.com/ansible/ansible-lint
    rev: v25.1.0
    hooks:
      - id: ansible-lint
        additional_dependencies:
          - ansible>=9.8.0,<10.0.0
          - ansible-compat==24.10.0

```

With pre-commit 4.2.0 is all fine. With pre-commit 4.3.0 I see

```shell
Ansible-lint.............................................................Failed
- hook id: ansible-lint
- exit code: 1

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/root/.cache/pre-commit/repozusqqq7n/py_env-python3.12/lib/python3.12/site-packages/ansiblelint/ __main__.py", line 50, in <module>
    from ansiblelint import cli
  File "/root/.cache/pre-commit/repozusqqq7n/py_env-python3.12/lib/python3.12/site-packages/ansiblelint/cli.py", line 13, in <module>
    from ansiblelint.config import (
  File "/root/.cache/pre-commit/repozusqqq7n/py_env-python3.12/lib/python3.12/site-packages/ansiblelint/config.py", line 118, in <module>
    PROFILES = yaml_from_file(Path( __file__ ).parent / "data" / "profiles.yml")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/pre-commit/repozusqqq7n/py_env-python3.12/lib/python3.12/site-packages/ansiblelint/loaders.py", line 40, in yaml_from_file
    with open(str(filepath), encoding="utf-8") as content:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/pre-commit/repozusqqq7n/py_env-python3.12/lib/python3.12/site-packages/ansiblelint/data/profiles.yml'

```

Do you know how to fix this?  
I tried to open [an issue on pre-commit](https://github.com/pre-commit/pre-commit/issues/3569), but if I understand well they say that this is not supported.

Thank you  
Kind Regards  
Marco

---

<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 6, 2025, 12:43pm UTC](https://forum.ansible.com/t/ansible-lint-hook-no-longer-works-with-pre-commit-4-3-0/44792/2 "2025-11-06T12:43:36Z")

</div>

According to your `pre-commit` bug report, the file that can’t be found is:

> /root/.cache/pre-commit/repozusqqq7n/py\_env-python3.12/lib/python3.12/site-packages/ansiblelint/data/profiles.yml

Locally, I used `uv` to install Python 3.12 and the latest ansiblelint package in isolated environment to see if it includes a `data/profiles.yml` file and it does. Here’s what I got on my system:

> ./lib/python3.12/site-packages/ansiblelint/data/profiles.yml

That suggests that the problem with the file being “not found” is not in /that/ part of the path, but further up the tree in the part that `pre-commit` controls. Combined with your inside that it worked in pre-commit 4.2 but not 4.3 does suggest it’s a bug on their end.

Also, if you not running in a virtual machine or container, consider not using the `root` account for development, which brings security risks.

---

<div class="post-metadata">

**Author:** ![falon](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/falon/32/2081_2.png) [@falon](https://forum.ansible.com/u/falon)\
**Post date:** [November 7, 2025, 11:07am UTC](https://forum.ansible.com/t/ansible-lint-hook-no-longer-works-with-pre-commit-4-3-0/44792/3 "2025-11-07T11:07:39Z")

</div>

Hello Mark,

yes, I have the profile:

```auto
ansible [core 2.16.14]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.12/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.12.9 (main, Aug 14 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5.0.1)] (/usr/bin/python3.12)
  jinja version = 3.1.6
  libyaml = True

ansible-lint 25.1.0 using ansible-core:2.16.14 ansible-compat:24.10.0 ruamel-yaml:0.18.16 ruamel-yaml-clib:0.2.14

# ll /usr/local/lib/python3.12/site-packages/ansiblelint/data/profiles.yml
-rw-r--r-- 1 root root 4.0K Oct 31 11:40 /usr/local/lib/python3.12/site-packages/ansiblelint/data/profiles.yml

```

For what I can understand it seems that the problem is in `pre-commit` (`4.3.0` only), but I don’t know how to better explain this in the issue.

> [@markstos](#):
>
> Also, if you not running in a virtual machine or container, consider not using the `root` account for development, which brings security risks.

Thank you, always welcome these hints. I run **podman** as an unprivileged user (rootless), with processes in the container running as root.

Thank you  
Kind Regards  
Marco
