molfar_audit / Rules / ITM001

ITM001 Item is not defined in ox_inventory

warning ox_inventory items

Code gives, takes or searches an item name that ox_inventory does not know.

Why it matters

Giving an unknown item silently fails, so a job reward, shop or crafting step breaks for players without any error. The check covers ox_inventory exports (AddItem, RemoveItem, Search, GetItemCount, CanCarryItem…), the QB bridge (Player.Functions.AddItem), ESX (xPlayer.addInventoryItem) and your own wrapper functions from config.json. Names are compared case-insensitively, like ox_inventory does.

How to fix

Add the item to ox_inventory/data/items.lua, or fix the item name in the code.

Reported
exports.ox_inventory:AddItem(source, 'moneybag', 1)
-- 'moneybag' is not in data/items.lua
Fixed
-- ox_inventory/data/items.lua
['moneybag'] = {
    label = 'Money bag',
    weight = 200,
},

Using your own function to give items? Add it to config.json: "items": { "extraFunctions": [{ "name": "GiveItem", "argument": 2 }] }, where argument is the position of the item name.

Not a problem in your case?

Add -- molfar-audit-ignore ITM001 on the reported line (or the line above it), or ignore it in config.json: "ignore": [{ "rule": "ITM001", "resource": "your_resource" }].