Error when ansible tries to access inventory via Foreman plugin

Problem: Error when ansible tries to access inventory via Foreman plugin

Expected outcome:

Foreman plugin to return the inventory JSON for processing

Foreman and Proxy versions:

Foreman/Proxy 3.16.2

Foreman and Proxy plugin versions:

Ansible: 3.6.1
Dynflow: 0.9.4
Content: 3.4.0
Script: 0.11.6

Distribution and version:

AlmaLinux 9.7

Other relevant data:

When I try to display the inventory using ansible-inventory with the foreman.yml of the following:

---
plugin: theforeman.foreman.foreman
validate_certs: false
want_hostcollections: true
want_subnet: true

Environment variables FOREMAN_URL, FOREMAN_USER and FOREMAN_PASSWORD populated appropriately. The results are as below and the following is in the logs on the Foreman server.

Results:

[WARNING]: * Failed to parse /mnt/c/Users/BrFrost/OneDrive - Jack
Henry/GitHub/bfrost_ansible_playbook_dev/inventory/foreman.yml with script plugin: problem running
/mnt/c/Users/BrFrost/OneDrive - Jack Henry/GitHub/bfrost_ansible_playbook_dev/inventory/foreman.yml --list ([Errno 8]
Exec format error: ‘/mnt/c/Users/BrFrost/OneDrive - Jack
Henry/GitHub/bfrost_ansible_playbook_dev/inventory/foreman.yml’)
[WARNING]: * Failed to parse /mnt/c/Users/BrFrost/OneDrive - Jack
Henry/GitHub/bfrost_ansible_playbook_dev/inventory/foreman.yml with auto plugin: Error scheduling inventory report on
foreman. Please check foreman logs!
[WARNING]: * Failed to parse /mnt/c/Users/BrFrost/OneDrive - Jack
Henry/GitHub/bfrost_ansible_playbook_dev/inventory/foreman.yml with yaml plugin: Plugin configuration YAML file, not
YAML inventory
[WARNING]: * Failed to parse /mnt/c/Users/BrFrost/OneDrive - Jack
Henry/GitHub/bfrost_ansible_playbook_dev/inventory/foreman.yml with ini plugin: Invalid host pattern ‘—’ supplied,
‘—’ is normally a sign this is a YAML file.
[WARNING]: Unable to parse /mnt/c/Users/BrFrost/OneDrive - Jack
Henry/GitHub/bfrost_ansible_playbook_dev/inventory/foreman.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available

Relevant information from production.log:

2026-02-10T15:15:02 [I|app|da72bfc7] Started POST “/ansible/api/v2/ansible_inventories/schedule” for 172.22.68.1 at 2026-02-10 15:15:02 -0600
2026-02-10T15:15:02 [I|app|da72bfc7] Processing by Api::V2::AnsibleInventoriesController#schedule as /
2026-02-10T15:15:02 [I|app|da72bfc7] Parameters: {“input_values”=>“[FILTERED]”, “apiv”=>“v2”, “ansible_inventory”=>{“input_values”=>“[FILTERED]”}}
2026-02-10T15:15:02 [I|app|da72bfc7] Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (Duration: 0.4ms | Allocations: 116)
2026-02-10T15:15:02 [I|app|da72bfc7] Rendered layout api/v2/layouts/error_layout.json.erb (Duration: 0.7ms | Allocations: 200)
2026-02-10T15:15:02 [I|app|da72bfc7] Completed 422 Unprocessable Entity in 35ms (Views: 1.8ms | ActiveRecord: 10.4ms | Allocations: 8983)

What is the recommend process to further troubleshoot this issue. FYI, running against my test environment executed as expected.