vscode-ansible: (archlinux): Ansible could not initialize the preferred locale: unsupported locale setting

Summary

When i open ansible files, is right highlighted but throw the following error.

In Status bar i have Ansible info in red with this message : Screenshot_20221120_113030

Extension version

1.0.90 (and tried 1.0.98)

VS Code version

VSCodium 1.73.1 (release 22314)

Ansible Version

ansible [core 2.14.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/orblazer/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/orblazer/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True

OS / Environment

Linux, 5.15.78-1-MANJARO ansible-lint 6.8.6 using ansible 2.14.0

Relevant log output

cmd 'ansible-lint --version' was not executed with the following error: ' Error: Command failed: ansible-lint --version
Unable to find a working copy of ansible executable.

[Info  - 11:16:34 AM] [ansible-lint] ERROR: Ansible could not initialize the preferred locale: unsupported locale setting
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
  File "/usr/lib/python3.10/site-packages/ansiblelint/__main__.py", line 319, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
  File "/usr/lib/python3.10/site-packages/ansiblelint/__main__.py", line 214, in main
    app = get_app(offline=options.offline)
  File "/usr/lib/python3.10/site-packages/ansiblelint/app.py", line 325, in get_app
    app = App(options=default_options)
  File "/usr/lib/python3.10/site-packages/ansiblelint/app.py", line 47, in __init__
    self.runtime = Runtime(isolated=True)
  File "/usr/lib/python3.10/site-packages/ansible_compat/runtime.py", line 96, in __init__
    self.config = AnsibleConfig()
  File "/usr/lib/python3.10/site-packages/ansible_compat/config.py", line 422, in __init__
    config_dump = subprocess.check_output(
  File "/usr/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ansible-config', 'dump']' returned non-zero exit status 1.

[Error - 11:16:34 AM] An error occurred in 'onDidOpen' handler: [TypeError] Cannot read properties of undefined (reading 'has')
TypeError: Cannot read properties of undefined (reading 'has')
    at /home/orblazer/.vscode-oss/extensions/redhat.ansible-1.0.98-universal/out/server/src/server.js:2:44793
    at Generator.next (<anonymous>)
    at s (/home/orblazer/.vscode-oss/extensions/redhat.ansible-1.0.98-universal/out/server/src/server.js:2:42432)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@ssbarnea - I have exactly same problem running ansible command inside vscode terminal connected to container ansible installed in. However, when I attach to container’s shell without vscode it works fine. I compared environments in-fact vscode pushes many environment variables.

Could you help me with… configuring vscode not to push it’s environment when opening/connecting to container.

I notice that the langue in my docker desktop is POSIX, but when I use vscdoe container to run it, i found i became en_US.UTF-8, so i just install the en language package and it works well i use this command to install the package apt install language-pack-en