Skip to main content

Inventory rejected by GLPI (error 400 “JSON does not validate”): computer without a UUID

Applies to: Medulla Server 5.6.x with GLPI 10 and the GLPI Inventory plugin
Date: November 26, 2026
Environment: Medulla server running Linux, commands executed as root
Category: Inventory, GLPI, diagnostics

1. Symptoms

  • The computer is shown as ON in Medulla’s XMPP list: the agent is running.
  • It has no inventory UUID (uuid_inventorymachine is empty) and does not appear in the list of computers.
  • It does not exist in GLPI (Assets > Computers), nor in the trash, nor among rejected devices.
  • Requesting a new inventory does not change anything.

Pitfall: The inventory substitute displays forward_done=True even when GLPI has rejected the inventory. This message therefore does not prove that the inventory was accepted.

2. Confirm the diagnosis

2.1 Read GLPI’s response in the substitute’s log

Replace EXAMPLE_WORKSTATION with the workstation name:

sudo grep -i -A20 "Received inventory from EXAMPLE_WORKSTATION" /var/log/mmc/master-inv.log | grep -E "Received|ERROR|forward_done|No machine found" | tail -20

The scenario discussed here can be identified by these lines:

INFO - Received inventory from poste_exemple.xyz@pulse/... in inventory substitute agent
INFO - Send content to url : http://<server>/glpi/plugins/glpiinventory/front/plugin_fusioninventory.communication.php
ERROR - 400
ERROR - b'<?xml version="1.0"?>\n<REPLY><ERROR><![CDATA[JSON does not validate. Violations:\nRequired property missing: cmd, data: {"cpuusage":"0.00","pid":...,"user":"...",...} at #->properties:content->properties:processes...
INFO - Inventory injection mode=forward forward_done=True module_done=False
WARNING - No machine found for MAC: xx:xx:xx:xx:xx:xx
ERROR - After injection of the inventory, no inventory is found for the address Macs.

Other results: no “Received inventory” line: the workstation is not sending an inventory (see GLPI-Agent on the workstation). ERROR - 404: url_to_forward is incorrect (Medulla Agents script FAQ).

2.2 Check on the GLPI side (optional)

sudo mysql glpi -e "SELECT id, name, is_deleted FROM glpi_computers WHERE name LIKE 'EXAMPLE_WORKSTATION%';
SELECT id, name, items_id FROM glpi_agents WHERE name LIKE 'EXAMPLE_WORKSTATION%';
SELECT name, rules_id FROM glpi_refusedequipments WHERE name LIKE 'EXAMPLE_WORKSTATION%';"

In this case, the three queries return nothing: GLPI rejected the inventory before processing it. There is no record, agent, or import rule involved.

3. Cause

GLPI 10 converts each inventory to JSON and validates it against a strict schema (glpi-inventory-format). A single invalid entry causes the entire inventory to be rejected, resulting in an HTTP 400 error.

The issue encountered: GLPI-Agent reports a process without a command line (protected process or unreadable command). The cmd property is then missing, even though the schema requires it. This type of process depends on what is running on the workstation at the time of the inventory: the problem may affect a single computer, or it may appear and disappear.

4. Fix

The fix is applied on the server, without any action required on the workstations. Before each submission to GLPI, the inventory substitute runs the Python scripts in the xml_fix folder (/var/lib/pulse2/xml_fix/ by default, or the value of [glpi] xml_fix in /etc/pulse-xmpp-agent-substitute/agent_master_substitute_inv.ini.local). A script is added to this folder that removes only the incomplete processes from the inventory. The rest of the inventory remains unchanged.

4.1 Using the Medulla Agents script (V73 or later)

sudo ./medulla_agents_V73.py --exporter-xmlfix

The script displays the file it is about to write (11_Processes_without_cmd.py) and prompts for confirmation with OUI. It never overwrites an existing file and does nothing if an equivalent fix is already installed. An audit using V73 also flags the affected computers, with the reason “Inventaire refuse par GLPI (processus sans ligne de commande)”.

4.2 Manually

First, check the contents of the folder. Scripts run in alphabetical order, and the numeric prefix must not already be in use (a file named 10_Apple_consistency.py is included by default, hence the 11_ prefix):

ls /var/lib/pulse2/xml_fix/

Create the patch by pasting the entire block:

sudo tee /var/lib/pulse2/xml_fix/11_Processes_without_cmd.py > /dev/null <<'EOF'
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2024-2026 Medulla / Natsu, http://www.medulla-tech.io
# SPDX-License-Identifier: GPL-3.0-or-later


def xml_fix(xml):
    """
    Supprime les entrees REQUEST/CONTENT/PROCESSES sans CMD (ou sans PID / USER).
    GLPI 10 refuse sinon tout l'inventaire (HTTP 400 "Required property missing: cmd").
    """
    import xml.etree.ElementTree as ET

    if isinstance(xml, bytes):
        xml = xml.decode("utf-8")
    root = ET.fromstring(xml)
    content = root.find("./CONTENT")
    if content is None:
        return xml
    retires = 0
    for proc in list(content.findall("PROCESSES")):
        for champ in ("CMD", "PID", "USER"):
            noeud = proc.find(champ)
            if noeud is None or not (noeud.text or "").strip():
                content.remove(proc)
                retires += 1
                break
    if not retires:
        return xml
    return ET.tostring(root, encoding="unicode")
EOF
sudo chmod 644 /var/lib/pulse2/xml_fix/11_Processes_without_cmd.py
sudo python3 -m py_compile /var/lib/pulse2/xml_fix/11_Processes_without_cmd.py && echo OK

The last command should display OK.

No restart is necessary: the scripts in the xml_fix folder are reloaded with every inventory received.

5. Validate the correction

  1. Request an inventory for the workstation: select the Inventory action on its record in the Medulla console, or use menu 10 in the Medulla Agents script.
  2. Watch for the inventory to arrive (usually one to three minutes):
    sudo tail -f /var/log/mmc/master-inv.log | grep --line-buffered -iE "EXAMPLE_WORKSTATION|ERROR|forward_done"
    There should no longer be an ERROR - 400 after “Received inventory from.”
  3. Verify that the record exists in GLPI, then that the UUID has been reported back to Medulla:
    sudo mysql glpi -e "SELECT id, name, date_mod FROM glpi_computers WHERE name LIKE 'EXAMPLE_WORKSTATION%';"
    sudo mysql xmppmaster -e "SELECT hostname, enabled, uuid_inventorymachine FROM machines WHERE hostname LIKE 'EXAMPLE_WORKSTATION%';"

6. Find the other affected workstations

To determine the number of rejections and the list of workstations for which an inventory was followed by a GLPI error:

sudo grep -c "JSON does not validate" /var/log/mmc/master-inv.log
sudo awk '/Received inventory from/ {h=$0; sub(/.*Received inventory from /,"",h); sub(/@.*/,"",h); sub(/\.[^.]*$/,"",h)} / - ERROR - [45][0-9][0-9]$/ {print h}' /var/log/mmc/master-inv.log | sort | uniq -c

A V73 audit (--perimetre on --dry-run) provides the same list, with the reason for each computer listed in its record. Once the fix is installed, request the inventory for these workstations again (menu 10).

7. Other reasons for error 400

The GLPI message indicates the missing or invalid property and its section in the schema, for example, Required property missing: cmd … content->properties:processes. For other reasons:

  • locate the relevant section (processes, softwares, cpus…);
  • check whether a newer version of GLPI-Agent or the GLPI Inventory plugin corrects the data;
  • otherwise, an xml_fix patch based on the same template can remove or complete the invalid entry. The files provided in /var/lib/pulse2/xml_fix/ serve as examples.

To examine the submitted inventory, the substitute’s dump option (xml_fix/xmldumpdir directory; see agent_master_substitute_inv.ini) saves the XML before and after correction. Disable this option after use: the files contain the workstation’s data.

8. Undoing the fix

To remove the fix, move it out of the folder. It will no longer be applied starting with the next inventory run:

sudo mv /var/lib/pulse2/xml_fix/11_Processes_without_cmd.py /root/

9. Summary

Step Command or action
Diagnosis grep -A20 "Received inventory from EXAMPLE_WORKSTATION" /var/log/mmc/master-inv.log: ERROR - 400 and Required property missing: cmd
Fix (V73) ./medulla_agents_V73.py --exporter-xmlfix
Manual fix Create /var/lib/pulse2/xml_fix/11_Processes_without_cmd.py (section 4.2)
Validation New inventory, no 400 in master-inv.log, GLPI record created, UUID in Medulla
Undoing the fix Move the file out of xml_fix

See also: Diagnose and fix Medulla agents (Medulla Agents V73 script).