# Role import errors with "dependencies must be a list of strings"

**URL:** <https://forum.ansible.com/t/role-import-errors-with-dependencies-must-be-a-list-of-strings/1930>\
**Category:** Get Help\
**Tags:** role, galaxy-ng\
**Created:** [October 24, 2023, 9:16pm UTC](https://forum.ansible.com/t/role-import-errors-with-dependencies-must-be-a-list-of-strings/1930 "2023-10-24T21:16:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrainStone](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/brainstone/32/1297_2.png) [@BrainStone](https://forum.ansible.com/u/BrainStone)\
**Post date:** [October 24, 2023, 9:16pm UTC](https://forum.ansible.com/t/role-import-errors-with-dependencies-must-be-a-list-of-strings/1930/1 "2023-10-24T21:16:20Z")

</div>

Hey, so I’m having this issue where the role import is currently complaining about my list of dependencies (in my `meta/main.yml` as that’s the only place I even have them declared).

What I’m doing there should work according to Ansible docs:

- [Roles — Ansible Documentation](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#using-role-dependencies) (latest docs)
- [Roles — Ansible Documentation](https://docs.ansible.com/ansible/2.9/user_guide/playbooks_reuse_roles.html#role-dependencies) (2.9 docs)

Code:

```yml
dependencies:
  - role: geerlingguy.nodejs
    tags: ["nodejs"]
    vars:
      nodejs_version: "{{ wireguard_easy_nodejs_version }}"
    when: "not (wireguard_easy_skip_nodejs | bool)"
    ignore_errors: "{{ ansible_check_mode }}"

```

However when I run `ansible-galaxy role import ...` I get this error:

```auto
Successfully submitted import request 2052975251017006893475265785414423458
running
dependencies must be a list of strings
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 224, in legacy_role_import
    result = import_legacy_role(checkout_path, namespace.name, importer_config, logger)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 51, in import_legacy_role
    return _import_legacy_role(dirname, namespace, cfg, logger)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 57, in _import_legacy_role
    data = LegacyRoleLoader(dirname, namespace, cfg, logger).load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 41, in load
    self.metadata = self._load_metadata()
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 77, in _load_metadata
    return schema.LegacyMetadata.parse(meta_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/schema.py", line 536, in parse
    return cls(galaxy_info, dependencies)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<attrs generated init galaxy_importer.schema.LegacyMetadata>", line 10, in __init__
    __attr_validator_dependencies(self,__attr_dependencies, self.dependencies)
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/schema.py", line 544, in _validate_dependencies
    raise exc.LegacyRoleSchemaError("dependencies must be a list of strings")

```

Ansible Info:

```auto
ansible-galaxy [core 2.12.10]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/yannick/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/yannick/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-galaxy
  python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
  jinja version = 3.0.3
  libyaml = True

```

What’s going on here? I’m aware that I’m not on the latest version, but that shouldn’t matter as according to the docs what I’m doing should work since at least 2.9

---

<div class="post-metadata">

**Author:** ![sleif](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sleif/32/1363_2.png) [@sleif](https://forum.ansible.com/u/sleif)\
**Post date:** [October 30, 2023, 8:08am UTC](https://forum.ansible.com/t/role-import-errors-with-dependencies-must-be-a-list-of-strings/1930/2 "2023-10-30T08:08:59Z")

</div>

Hello,  
I’ve the same problem:

```bash
ansible-galaxy --version git:(main|) 
ansible-galaxy [core 2.15.2]
  configured module search path = ['/Users/XXX/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/XXX/.pyenv/versions/3.10.6/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/XX/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/NVK/.pyenv/versions/3.10.6/bin/ansible-galaxy
  python version = 3.10.6 (main, Sep 19 2022, 15:39:33) [Clang 14.0.0 (clang-1400.0.29.102)] (/Users/XXX/.pyenv/versions/3.10.6/bin/python3.10)
  jinja version = 3.1.2
  libyaml = True

```

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [October 31, 2023, 6:11pm UTC](https://forum.ansible.com/t/role-import-errors-with-dependencies-must-be-a-list-of-strings/1930/3 "2023-10-31T18:11:15Z")

</div>

I’ve opened a jira to get this prioritized and fixed [Loading...](https://issues.redhat.com/browse/AAH-2823)
